idx
int64 | func
string | target
int64 |
|---|---|---|
220,232
|
AttrSlice Node::attrs() const { return AttrSlice(def()); }
| 0
|
417,110
|
mp_sint32 PlayerGeneric::getCurrentSamplePosition() const
{
if (mixer && mixer->getAudioDriver())
return mixer->getAudioDriver()->getBufferPos();
return 0;
}
| 0
|
225,505
|
Status MutableGraphView::AddSubgraph(GraphDef&& subgraph) {
// 1. Add all new functions and check that functions with the same name
// have identical definition.
const int function_size = subgraph.library().function_size();
if (function_size > 0) {
absl::flat_hash_map<absl::string_view, const FunctionDef*> graph_fdefs;
for (const FunctionDef& fdef : graph()->library().function()) {
graph_fdefs.emplace(fdef.signature().name(), &fdef);
}
for (FunctionDef& fdef : *subgraph.mutable_library()->mutable_function()) {
const auto graph_fdef = graph_fdefs.find(fdef.signature().name());
if (graph_fdef == graph_fdefs.end()) {
VLOG(3) << "Add new function definition: " << fdef.signature().name();
graph()->mutable_library()->add_function()->Swap(&fdef);
} else {
if (!FunctionDefsEqual(fdef, *graph_fdef->second)) {
return MutationError(
"AddSubgraph",
absl::Substitute("function_size=$0", function_size),
absl::StrCat(
"Found different function definition with the same name: ",
fdef.signature().name()));
}
}
}
}
// 2. Add all nodes to the underlying graph.
int node_size_before = graph()->node_size();
for (NodeDef& node : *subgraph.mutable_node()) {
auto* node_in_graph = graph()->add_node();
node_in_graph->Swap(&node);
TF_RETURN_IF_ERROR(AddUniqueNode(node_in_graph));
}
// TODO(ezhulenev, lyandy): Right now AddAndDedupFanouts do not check that
// fanins actually exists in the graph, and there is already TODO for that.
for (int i = node_size_before; i < graph()->node_size(); ++i) {
NodeDef* node = graph()->mutable_node(i);
AddAndDedupFanouts(node);
}
return Status::OK();
}
| 0
|
224,990
|
PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg)
{
PQnoticeProcessor old;
if (conn == NULL)
return NULL;
old = conn->noticeHooks.noticeProc;
if (proc)
{
conn->noticeHooks.noticeProc = proc;
conn->noticeHooks.noticeProcArg = arg;
}
return old;
}
| 0
|
289,262
|
static const char *strip_task_path(const char *path)
{
const char *ptr, *ptrl = NULL;
for (ptr = path; *ptr; ptr++) {
if (*ptr == '/')
ptrl = ptr + 1;
}
return ptrl;
}
| 0
|
294,690
|
date_s_strptime(int argc, VALUE *argv, VALUE klass)
{
VALUE str, fmt, sg;
rb_scan_args(argc, argv, "03", &str, &fmt, &sg);
switch (argc) {
case 0:
str = rb_str_new2("-4712-01-01");
case 1:
fmt = rb_str_new2("%F");
case 2:
sg = INT2FIX(DEFAULT_SG);
}
{
VALUE argv2[2], hash;
argv2[0] = str;
argv2[1] = fmt;
hash = date_s__strptime(2, argv2, klass);
return d_new_by_frags(klass, hash, sg);
}
}
| 0
|
257,693
|
static int recv_rfc_6455(handler_ctx *hctx) {
request_st * const r = hctx->gw.r;
chunkqueue *cq = &r->reqbody_queue;
buffer *payload = hctx->frame.payload;
DEBUG_LOG_DEBUG("recv data from client (fd=%d), size=%llx",
r->con->fd, (long long)chunkqueue_length(cq));
for (chunk *c = cq->first; c; c = c->next) {
char *frame = c->mem->ptr+c->offset;
/*(chunk_remaining_length() on MEM_CHUNK)*/
size_t flen = (size_t)(buffer_clen(c->mem) - c->offset);
/*(FILE_CHUNK not handled, but might need to add support)*/
force_assert(c->type == MEM_CHUNK);
for (size_t i = 0; i < flen; ) {
switch (hctx->frame.state) {
case MOD_WEBSOCKET_FRAME_STATE_INIT:
switch (frame[i] & 0x0f) {
case MOD_WEBSOCKET_OPCODE_CONT:
DEBUG_LOG_DEBUG("%s", "type = continue");
hctx->frame.type = hctx->frame.type_before;
break;
case MOD_WEBSOCKET_OPCODE_TEXT:
DEBUG_LOG_DEBUG("%s", "type = text");
hctx->frame.type = MOD_WEBSOCKET_FRAME_TYPE_TEXT;
hctx->frame.type_before = hctx->frame.type;
break;
case MOD_WEBSOCKET_OPCODE_BIN:
DEBUG_LOG_DEBUG("%s", "type = binary");
hctx->frame.type = MOD_WEBSOCKET_FRAME_TYPE_BIN;
hctx->frame.type_before = hctx->frame.type;
break;
case MOD_WEBSOCKET_OPCODE_PING:
DEBUG_LOG_DEBUG("%s", "type = ping");
hctx->frame.type = MOD_WEBSOCKET_FRAME_TYPE_PING;
break;
case MOD_WEBSOCKET_OPCODE_PONG:
DEBUG_LOG_DEBUG("%s", "type = pong");
hctx->frame.type = MOD_WEBSOCKET_FRAME_TYPE_PONG;
break;
case MOD_WEBSOCKET_OPCODE_CLOSE:
DEBUG_LOG_DEBUG("%s", "type = close");
hctx->frame.type = MOD_WEBSOCKET_FRAME_TYPE_CLOSE;
return -1;
break;
default:
DEBUG_LOG_ERR("%s", "type is invalid");
return -1;
break;
}
i++;
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_READ_LENGTH;
break;
case MOD_WEBSOCKET_FRAME_STATE_READ_LENGTH:
if ((frame[i] & 0x80) != 0x80) {
DEBUG_LOG_ERR("%s", "payload was not masked");
return -1;
}
hctx->frame.ctl.mask_cnt = 0;
hctx->frame.ctl.siz = (uint64_t)(frame[i] & 0x7f);
if (hctx->frame.ctl.siz == 0) {
DEBUG_LOG_DEBUG("specified payload size=%llx",
(unsigned long long)hctx->frame.ctl.siz);
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_READ_MASK;
}
else if (hctx->frame.ctl.siz == MOD_WEBSOCKET_FRAME_LEN16) {
hctx->frame.ctl.siz = 0;
hctx->frame.ctl.siz_cnt = MOD_WEBSOCKET_FRAME_LEN16_CNT;
hctx->frame.state =
MOD_WEBSOCKET_FRAME_STATE_READ_EX_LENGTH;
}
else if (hctx->frame.ctl.siz == MOD_WEBSOCKET_FRAME_LEN63) {
hctx->frame.ctl.siz = 0;
hctx->frame.ctl.siz_cnt = MOD_WEBSOCKET_FRAME_LEN63_CNT;
hctx->frame.state =
MOD_WEBSOCKET_FRAME_STATE_READ_EX_LENGTH;
}
else {
DEBUG_LOG_DEBUG("specified payload size=%llx",
(unsigned long long)hctx->frame.ctl.siz);
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_READ_MASK;
}
i++;
break;
case MOD_WEBSOCKET_FRAME_STATE_READ_EX_LENGTH:
hctx->frame.ctl.siz =
(hctx->frame.ctl.siz << 8) + (frame[i] & 0xff);
hctx->frame.ctl.siz_cnt--;
if (hctx->frame.ctl.siz_cnt <= 0) {
if (hctx->frame.type == MOD_WEBSOCKET_FRAME_TYPE_PING &&
hctx->frame.ctl.siz > MOD_WEBSOCKET_BUFMAX) {
DEBUG_LOG_WARN("frame size has been exceeded: %x",
MOD_WEBSOCKET_BUFMAX);
return -1;
}
DEBUG_LOG_DEBUG("specified payload size=%llx",
(unsigned long long)hctx->frame.ctl.siz);
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_READ_MASK;
}
i++;
break;
case MOD_WEBSOCKET_FRAME_STATE_READ_MASK:
hctx->frame.ctl.mask[hctx->frame.ctl.mask_cnt] = frame[i];
hctx->frame.ctl.mask_cnt++;
if (hctx->frame.ctl.mask_cnt >= MOD_WEBSOCKET_MASK_CNT) {
hctx->frame.ctl.mask_cnt = 0;
if (hctx->frame.type == MOD_WEBSOCKET_FRAME_TYPE_PING &&
hctx->frame.ctl.siz == 0) {
mod_wstunnel_frame_send(hctx,
MOD_WEBSOCKET_FRAME_TYPE_PONG,
NULL, 0);
}
if (hctx->frame.ctl.siz == 0) {
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_INIT;
}
else {
hctx->frame.state =
MOD_WEBSOCKET_FRAME_STATE_READ_PAYLOAD;
}
}
i++;
break;
case MOD_WEBSOCKET_FRAME_STATE_READ_PAYLOAD:
/* hctx->frame.ctl.siz <= SIZE_MAX */
if (hctx->frame.ctl.siz <= flen - i) {
DEBUG_LOG_DEBUG("read payload, size=%llx",
(unsigned long long)hctx->frame.ctl.siz);
buffer_append_string_len(payload, frame+i, (size_t)
(hctx->frame.ctl.siz & SIZE_MAX));
i += (size_t)(hctx->frame.ctl.siz & SIZE_MAX);
hctx->frame.ctl.siz = 0;
hctx->frame.state = MOD_WEBSOCKET_FRAME_STATE_INIT;
DEBUG_LOG_DEBUG("rest of frame size=%zx", flen - i);
/* SIZE_MAX < hctx->frame.ctl.siz */
}
else {
DEBUG_LOG_DEBUG("read payload, size=%zx", flen - i);
buffer_append_string_len(payload, frame+i, flen - i);
hctx->frame.ctl.siz -= flen - i;
i += flen - i;
DEBUG_LOG_DEBUG("rest of payload size=%llx",
(unsigned long long)hctx->frame.ctl.siz);
}
switch (hctx->frame.type) {
case MOD_WEBSOCKET_FRAME_TYPE_TEXT:
case MOD_WEBSOCKET_FRAME_TYPE_BIN:
{
unmask_payload(hctx);
chunkqueue_append_buffer(&hctx->gw.wb, payload);
/*buffer_clear(payload);*//*chunkqueue_append_buffer clear*/
break;
}
case MOD_WEBSOCKET_FRAME_TYPE_PING:
if (hctx->frame.ctl.siz == 0) {
unmask_payload(hctx);
mod_wstunnel_frame_send(hctx,
MOD_WEBSOCKET_FRAME_TYPE_PONG,
payload->ptr, buffer_clen(payload));
buffer_clear(payload);
}
break;
case MOD_WEBSOCKET_FRAME_TYPE_PONG:
buffer_clear(payload);
break;
case MOD_WEBSOCKET_FRAME_TYPE_CLOSE:
default:
DEBUG_LOG_ERR("%s", "BUG: invalid frame type");
return -1;
}
break;
default:
DEBUG_LOG_ERR("%s", "BUG: invalid state");
return -1;
}
}
}
/* XXX: should add ability to handle and preserve partial frames above */
/*(not chunkqueue_reset(); do not reset cq->bytes_in, cq->bytes_out)*/
chunkqueue_mark_written(cq, chunkqueue_length(cq));
return 0;
}
| 0
|
263,491
|
static int sco_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
{
struct sockaddr_sco *sa = (struct sockaddr_sco *) addr;
struct sock *sk = sock->sk;
int err = 0;
if (!addr || addr_len < sizeof(struct sockaddr_sco) ||
addr->sa_family != AF_BLUETOOTH)
return -EINVAL;
BT_DBG("sk %p %pMR", sk, &sa->sco_bdaddr);
lock_sock(sk);
if (sk->sk_state != BT_OPEN) {
err = -EBADFD;
goto done;
}
if (sk->sk_type != SOCK_SEQPACKET) {
err = -EINVAL;
goto done;
}
bacpy(&sco_pi(sk)->src, &sa->sco_bdaddr);
sk->sk_state = BT_BOUND;
done:
release_sock(sk);
return err;
}
| 0
|
253,527
|
static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
loff_t off, loff_t len)
{
int rc;
unsigned int xid;
struct inode *inode;
struct cifsFileInfo *cfile = file->private_data;
struct cifsInodeInfo *cifsi;
__le64 eof;
xid = get_xid();
inode = d_inode(cfile->dentry);
cifsi = CIFS_I(inode);
if (off >= i_size_read(inode) ||
off + len >= i_size_read(inode)) {
rc = -EINVAL;
goto out;
}
rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
i_size_read(inode) - off - len, off);
if (rc < 0)
goto out;
eof = cpu_to_le64(i_size_read(inode) - len);
rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
cfile->fid.volatile_fid, cfile->pid, &eof);
if (rc < 0)
goto out;
rc = 0;
cifsi->server_eof = i_size_read(inode) - len;
truncate_setsize(inode, cifsi->server_eof);
fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof);
out:
free_xid(xid);
return rc;
}
| 0
|
447,069
|
long CurlIo::CurlImpl::getFileLength()
{
curl_easy_reset(curl_); // reset all options
std::string response;
curl_easy_setopt(curl_, CURLOPT_URL, path_.c_str());
curl_easy_setopt(curl_, CURLOPT_NOBODY, 1); // HEAD
curl_easy_setopt(curl_, CURLOPT_WRITEFUNCTION, curlWriter);
curl_easy_setopt(curl_, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl_, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl_, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl_, CURLOPT_CONNECTTIMEOUT, timeout_);
//curl_easy_setopt(curl_, CURLOPT_VERBOSE, 1); // debugging mode
/* Perform the request, res will get the return code */
CURLcode res = curl_easy_perform(curl_);
if(res != CURLE_OK) { // error happends
throw Error(1, curl_easy_strerror(res));
}
// get return code
long returnCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &returnCode); // get code
if (returnCode >= 400 || returnCode < 0) {
throw Error(55, "Server", returnCode);
}
// get length
double temp;
curl_easy_getinfo(curl_, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &temp); // return -1 if unknown
return (long) temp;
}
| 0
|
246,694
|
static Bool PrintHelpArg(char *arg_name, u32 search_type, GF_FilterSession *fs)
{
Bool first=GF_TRUE;
GF_GPACArg an_arg;
u32 i, count;
u32 res = 0;
u32 alen = (u32) strlen(arg_name);
res += PrintHelpForArgs(arg_name, m4b_gen_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_split_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_dash_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_imp_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_imp_fileopt_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_senc_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_crypt_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_hint_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_extr_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_dump_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_meta_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_swf_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_liveenc_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, m4b_usage_args, NULL, search_type);
res += PrintHelpForArgs(arg_name, NULL, (GF_GPACArg *) gf_sys_get_options(), search_type);
if (!fs) return res;
memset(&an_arg, 0, sizeof(GF_GPACArg));
count = gf_fs_filters_registers_count(fs);
for (i=0; i<count; i++) {
u32 j=0;
const GF_FilterRegister *reg = gf_fs_get_filter_register(fs, i);
while (reg->args) {
u32 len;
const GF_FilterArgs *arg = ®->args[j];
if (!arg || !arg->arg_name) break;
j++;
if ((search_type==SEARCH_ARG_EXACT) && strcmp(arg->arg_name, arg_name)) continue;
if ((search_type==SEARCH_ARG_CLOSE) && !gf_sys_word_match(arg->arg_name, arg_name)) continue;
if (search_type==SEARCH_DESC) {
if (!strstr_nocase(arg->arg_desc, arg_name, alen)) continue;
}
an_arg.name = arg->arg_name;
if (search_type==SEARCH_ARG_EXACT) {
an_arg.description = arg->arg_desc;
switch (arg->arg_type) {
case GF_PROP_BOOL:
an_arg.type = GF_ARG_BOOL;
break;
case GF_PROP_UINT:
case GF_PROP_SINT:
an_arg.type = GF_ARG_INT;
break;
case GF_PROP_DOUBLE:
an_arg.type = GF_ARG_DOUBLE;
break;
case GF_PROP_STRING_LIST:
case GF_PROP_UINT_LIST:
case GF_PROP_SINT_LIST:
case GF_PROP_VEC2I_LIST:
an_arg.type = GF_ARG_STRINGS;
break;
case GF_PROP_4CC:
an_arg.type = GF_ARG_4CC;
break;
case GF_PROP_4CC_LIST:
an_arg.type = GF_ARG_4CCS;
break;
default:
an_arg.type = GF_ARG_STRING;
break;
}
if (first) {
first = GF_FALSE;
gf_sys_format_help(helpout, 0, "\nGlobal filter session arguments. Syntax is `--arg` or `--arg=VAL`. `[F]` indicates filter name. See `gpac -h` and `gpac -h F` for more info.\n");
}
fprintf(helpout, "[%s]", reg->name);
len = (u32)strlen(reg->name);
while (len<10) {
len++;
fprintf(helpout, " ");
}
fprintf(helpout, " ");
}
gf_sys_print_arg(helpout, GF_PRINTARG_ADD_DASH, &an_arg, "TEST");
res++;
}
}
if (res) return GF_TRUE;
return GF_FALSE;
}
| 0
|
232,957
|
static CURLcode inflate_stream(struct Curl_easy *data,
struct contenc_writer *writer,
zlibInitState started)
{
struct zlib_params *zp = (struct zlib_params *) &writer->params;
z_stream *z = &zp->z; /* zlib state structure */
uInt nread = z->avail_in;
Bytef *orig_in = z->next_in;
bool done = FALSE;
CURLcode result = CURLE_OK; /* Curl_client_write status */
char *decomp; /* Put the decompressed data here. */
/* Check state. */
if(zp->zlib_init != ZLIB_INIT &&
zp->zlib_init != ZLIB_INFLATING &&
zp->zlib_init != ZLIB_INIT_GZIP &&
zp->zlib_init != ZLIB_GZIP_INFLATING)
return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR);
/* Dynamically allocate a buffer for decompression because it's uncommonly
large to hold on the stack */
decomp = malloc(DSIZ);
if(!decomp)
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
/* because the buffer size is fixed, iteratively decompress and transfer to
the client via downstream_write function. */
while(!done) {
int status; /* zlib status */
done = TRUE;
/* (re)set buffer for decompressed output for every iteration */
z->next_out = (Bytef *) decomp;
z->avail_out = DSIZ;
#ifdef Z_BLOCK
/* Z_BLOCK is only available in zlib ver. >= 1.2.0.5 */
status = inflate(z, Z_BLOCK);
#else
/* fallback for zlib ver. < 1.2.0.5 */
status = inflate(z, Z_SYNC_FLUSH);
#endif
/* Flush output data if some. */
if(z->avail_out != DSIZ) {
if(status == Z_OK || status == Z_STREAM_END) {
zp->zlib_init = started; /* Data started. */
result = Curl_unencode_write(data, writer->downstream, decomp,
DSIZ - z->avail_out);
if(result) {
exit_zlib(data, z, &zp->zlib_init, result);
break;
}
}
}
/* Dispatch by inflate() status. */
switch(status) {
case Z_OK:
/* Always loop: there may be unflushed latched data in zlib state. */
done = FALSE;
break;
case Z_BUF_ERROR:
/* No more data to flush: just exit loop. */
break;
case Z_STREAM_END:
result = process_trailer(data, zp);
break;
case Z_DATA_ERROR:
/* some servers seem to not generate zlib headers, so this is an attempt
to fix and continue anyway */
if(zp->zlib_init == ZLIB_INIT) {
/* Do not use inflateReset2(): only available since zlib 1.2.3.4. */
(void) inflateEnd(z); /* don't care about the return code */
if(inflateInit2(z, -MAX_WBITS) == Z_OK) {
z->next_in = orig_in;
z->avail_in = nread;
zp->zlib_init = ZLIB_INFLATING;
zp->trailerlen = 4; /* Tolerate up to 4 unknown trailer bytes. */
done = FALSE;
break;
}
zp->zlib_init = ZLIB_UNINIT; /* inflateEnd() already called. */
}
result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z));
break;
default:
result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z));
break;
}
}
free(decomp);
/* We're about to leave this call so the `nread' data bytes won't be seen
again. If we are in a state that would wrongly allow restart in raw mode
at the next call, assume output has already started. */
if(nread && zp->zlib_init == ZLIB_INIT)
zp->zlib_init = started; /* Cannot restart anymore. */
return result;
}
| 0
|
404,737
|
static unsigned int find_next_fd(struct fdtable *fdt, unsigned int start)
{
unsigned int maxfd = fdt->max_fds;
unsigned int maxbit = maxfd / BITS_PER_LONG;
unsigned int bitbit = start / BITS_PER_LONG;
bitbit = find_next_zero_bit(fdt->full_fds_bits, maxbit, bitbit) * BITS_PER_LONG;
if (bitbit > maxfd)
return maxfd;
if (bitbit > start)
start = bitbit;
return find_next_zero_bit(fdt->open_fds, maxfd, start);
}
| 0
|
409,409
|
gather_termleader(void)
{
int i;
int len = 0;
#ifdef FEAT_GUI
if (gui.in_use)
termleader[len++] = CSI; // the GUI codes are not in termcodes[]
#endif
#ifdef FEAT_TERMRESPONSE
if (check_for_codes || *T_CRS != NUL)
termleader[len++] = DCS; // the termcode response starts with DCS
// in 8-bit mode
#endif
termleader[len] = NUL;
for (i = 0; i < tc_len; ++i)
if (vim_strchr(termleader, termcodes[i].code[0]) == NULL)
{
termleader[len++] = termcodes[i].code[0];
termleader[len] = NUL;
}
need_gather = FALSE;
}
| 0
|
301,467
|
suggest_try_change(suginfo_T *su)
{
char_u fword[MAXWLEN]; // copy of the bad word, case-folded
int n;
char_u *p;
int lpi;
langp_T *lp;
// We make a copy of the case-folded bad word, so that we can modify it
// to find matches (esp. REP items). Append some more text, changing
// chars after the bad word may help.
STRCPY(fword, su->su_fbadword);
n = (int)STRLEN(fword);
p = su->su_badptr + su->su_badlen;
(void)spell_casefold(curwin, p, (int)STRLEN(p), fword + n, MAXWLEN - n);
// Make sure the resulting text is not longer than the original text.
n = (int)STRLEN(su->su_badptr);
if (n < MAXWLEN)
fword[n] = NUL;
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
// If reloading a spell file fails it's still in the list but
// everything has been cleared.
if (lp->lp_slang->sl_fbyts == NULL)
continue;
// Try it for this language. Will add possible suggestions.
#ifdef SUGGEST_PROFILE
prof_init();
#endif
suggest_trie_walk(su, lp, fword, FALSE);
#ifdef SUGGEST_PROFILE
prof_report("try_change");
#endif
}
}
| 0
|
413,627
|
R_API void r_core_anal_datarefs(RCore *core, ut64 addr) {
RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, addr, -1);
if (fcn) {
bool found = false;
const char *me = fcn->name;
RListIter *iter;
RAnalRef *ref;
RList *refs = r_anal_function_get_refs (fcn);
r_list_foreach (refs, iter, ref) {
RBinObject *obj = r_bin_cur_object (core->bin);
RBinSection *binsec = r_bin_get_section_at (obj, ref->addr, true);
if (binsec && binsec->is_data) {
if (!found) {
r_cons_printf ("agn %s\n", me);
found = true;
}
RFlagItem *item = r_flag_get_i (core->flags, ref->addr);
r_strf_buffer (32);
const char *dst = item? item->name: r_strf ("0x%08"PFMT64x, ref->addr);
r_cons_printf ("agn %s\n", dst);
r_cons_printf ("age %s %s\n", me, dst);
}
}
r_list_free (refs);
} else {
eprintf ("Not in a function. Use 'df' to define it.\n");
}
}
| 0
|
301,388
|
NTSTATUS vfs_default_init(void)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
DEFAULT_VFS_MODULE_NAME, &vfs_default_fns);
}
| 0
|
445,901
|
open_files_data_ref (OpenFilesData *odata)
{
g_return_if_fail (odata != NULL);
odata->ref_count++;
}
| 0
|
387,584
|
int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
{
return snd_ctl_add_replace(card, kcontrol, CTL_ADD_EXCLUSIVE);
}
| 0
|
459,018
|
http_GetHdrField(const struct http *hp, hdr_t hdr,
const char *field, const char **ptr)
{
const char *h;
int i;
if (ptr != NULL)
*ptr = NULL;
h = NULL;
i = http_GetHdrToken(hp, hdr, field, &h, NULL);
if (!i)
return (i);
if (ptr != NULL && h != NULL) {
/* Skip whitespace, looking for '=' */
while (*h && vct_issp(*h))
h++;
if (*h == '=') {
h++;
while (*h && vct_issp(*h))
h++;
*ptr = h;
}
}
return (i);
}
| 0
|
204,019
|
static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offset,
struct inode **i)
{
struct squashfs_dir_header dirh;
char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]
__attribute__((aligned));
struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer;
long long start;
int bytes = 0, dir_count, size, res;
struct dir_ent *ent, *cur_ent = NULL;
struct dir *dir;
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
block_start, offset);
*i = read_inode(block_start, offset);
dir = malloc(sizeof(struct dir));
if(dir == NULL)
MEM_ERROR();
dir->dir_count = 0;
dir->cur_entry = NULL;
dir->mode = (*i)->mode;
dir->uid = (*i)->uid;
dir->guid = (*i)->gid;
dir->mtime = (*i)->time;
dir->xattr = (*i)->xattr;
dir->dirs = NULL;
if ((*i)->data == 3)
/*
* if the directory is empty, skip the unnecessary
* lookup_entry, this fixes the corner case with
* completely empty filesystems where lookup_entry correctly
* returning -1 is incorrectly treated as an error
*/
return dir;
start = sBlk.s.directory_table_start + (*i)->start;
offset = (*i)->offset;
size = (*i)->data + bytes - 3;
while(bytes < size) {
res = read_directory_data(&dirh, &start, &offset, sizeof(dirh));
if(res == FALSE)
goto corrupted;
SQUASHFS_INSWAP_DIR_HEADER(&dirh);
dir_count = dirh.count + 1;
TRACE("squashfs_opendir: Read directory header @ byte position "
"%d, %d directory entries\n", bytes, dir_count);
bytes += sizeof(dirh);
/* dir_count should never be larger than SQUASHFS_DIR_COUNT */
if(dir_count > SQUASHFS_DIR_COUNT) {
ERROR("File system corrupted: too many entries in directory\n");
goto corrupted;
}
while(dir_count--) {
res = read_directory_data(dire, &start, &offset, sizeof(*dire));
if(res == FALSE)
goto corrupted;
SQUASHFS_INSWAP_DIR_ENTRY(dire);
bytes += sizeof(*dire);
/* size should never be SQUASHFS_NAME_LEN or larger */
if(dire->size >= SQUASHFS_NAME_LEN) {
ERROR("File system corrupted: filename too long\n");
goto corrupted;
}
res = read_directory_data(dire->name, &start, &offset,
dire->size + 1);
if(res == FALSE)
goto corrupted;
dire->name[dire->size + 1] = '\0';
/* check name for invalid characters (i.e /, ., ..) */
if(check_name(dire->name, dire->size + 1) == FALSE) {
ERROR("File system corrupted: invalid characters in name\n");
goto corrupted;
}
TRACE("squashfs_opendir: directory entry %s, inode "
"%d:%d, type %d\n", dire->name,
dirh.start_block, dire->offset, dire->type);
ent = malloc(sizeof(struct dir_ent));
if(ent == NULL)
MEM_ERROR();
ent->name = strdup(dire->name);
ent->start_block = dirh.start_block;
ent->offset = dire->offset;
ent->type = dire->type;
ent->next = NULL;
if(cur_ent == NULL)
dir->dirs = ent;
else
cur_ent->next = ent;
cur_ent = ent;
dir->dir_count ++;
bytes += dire->size + 1;
}
}
return dir;
corrupted:
squashfs_closedir(dir);
return NULL;
}
| 1
|
450,385
|
static int vnc_client_read(VncState *vs)
{
size_t ret;
#ifdef CONFIG_VNC_SASL
if (vs->sasl.conn && vs->sasl.runSSF)
ret = vnc_client_read_sasl(vs);
else
#endif /* CONFIG_VNC_SASL */
ret = vnc_client_read_plain(vs);
if (!ret) {
if (vs->disconnecting) {
vnc_disconnect_finish(vs);
return -1;
}
return 0;
}
while (vs->read_handler && vs->input.offset >= vs->read_handler_expect) {
size_t len = vs->read_handler_expect;
int ret;
ret = vs->read_handler(vs, vs->input.buffer, len);
if (vs->disconnecting) {
vnc_disconnect_finish(vs);
return -1;
}
if (!ret) {
buffer_advance(&vs->input, len);
} else {
vs->read_handler_expect = ret;
}
}
return 0;
}
| 0
|
364,766
|
test_for_current(
#ifdef FEAT_EMACS_TAGS
int is_etag,
#endif
char_u *fname,
char_u *fname_end,
char_u *tag_fname,
char_u *buf_ffname)
{
int c;
int retval = FALSE;
char_u *fullname;
if (buf_ffname != NULL) // if the buffer has a name
{
#ifdef FEAT_EMACS_TAGS
if (is_etag)
c = 0; // to shut up GCC
else
#endif
{
c = *fname_end;
*fname_end = NUL;
}
fullname = expand_tag_fname(fname, tag_fname, TRUE);
if (fullname != NULL)
{
retval = (fullpathcmp(fullname, buf_ffname, TRUE, TRUE) & FPC_SAME);
vim_free(fullname);
}
#ifdef FEAT_EMACS_TAGS
if (!is_etag)
#endif
*fname_end = c;
}
return retval;
}
| 0
|
356,677
|
void Statement::Work_BeginEach(Baton* baton) {
// Only create the Async object when we're actually going into
// the event loop. This prevents dangling events.
EachBaton* each_baton = static_cast<EachBaton*>(baton);
each_baton->async = new Async(each_baton->stmt, reinterpret_cast<uv_async_cb>(AsyncEach));
each_baton->async->item_cb.Reset(each_baton->callback.Value(), 1);
each_baton->async->completed_cb.Reset(each_baton->completed.Value(), 1);
STATEMENT_BEGIN(Each);
}
| 0
|
452,384
|
static MagickBooleanType GetTIFFInfo(const ImageInfo *image_info,TIFF *tiff,
TIFFInfo *tiff_info)
{
#define TIFFStripSizeDefault 1048576
const char
*option;
MagickStatusType
flags;
uint32
tile_columns,
tile_rows;
assert(tiff_info != (TIFFInfo *) NULL);
(void) memset(tiff_info,0,sizeof(*tiff_info));
option=GetImageOption(image_info,"tiff:tile-geometry");
if (option == (const char *) NULL)
{
size_t
extent;
uint32
rows = 0,
rows_per_strip = 0;
extent=TIFFScanlineSize(tiff);
rows_per_strip=TIFFStripSizeDefault/(extent == 0 ? 1 : (uint32) extent);
rows_per_strip=16*(((rows_per_strip < 16 ? 16 : rows_per_strip)+1)/16);
(void) TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&rows);
if (rows_per_strip > rows)
rows_per_strip=rows;
option=GetImageOption(image_info,"tiff:rows-per-strip");
if (option != (const char *) NULL)
rows_per_strip=(uint32) strtoul(option,(char **) NULL,10);
rows_per_strip=TIFFDefaultStripSize(tiff,rows_per_strip);
(void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,rows_per_strip);
return(MagickTrue);
}
flags=ParseAbsoluteGeometry(option,&tiff_info->tile_geometry);
if ((flags & HeightValue) == 0)
tiff_info->tile_geometry.height=tiff_info->tile_geometry.width;
tile_columns=(uint32) tiff_info->tile_geometry.width;
tile_rows=(uint32) tiff_info->tile_geometry.height;
TIFFDefaultTileSize(tiff,&tile_columns,&tile_rows);
(void) TIFFSetField(tiff,TIFFTAG_TILEWIDTH,tile_columns);
(void) TIFFSetField(tiff,TIFFTAG_TILELENGTH,tile_rows);
tiff_info->tile_geometry.width=tile_columns;
tiff_info->tile_geometry.height=tile_rows;
if ((TIFFScanlineSize(tiff) <= 0) || (TIFFTileSize(tiff) <= 0))
{
DestroyTIFFInfo(tiff_info);
return(MagickFalse);
}
tiff_info->scanlines=(unsigned char *) AcquireQuantumMemory((size_t)
tile_rows*TIFFScanlineSize(tiff),sizeof(*tiff_info->scanlines));
tiff_info->pixels=(unsigned char *) AcquireQuantumMemory((size_t)
tile_rows*TIFFTileSize(tiff),sizeof(*tiff_info->scanlines));
if ((tiff_info->scanlines == (unsigned char *) NULL) ||
(tiff_info->pixels == (unsigned char *) NULL))
{
DestroyTIFFInfo(tiff_info);
return(MagickFalse);
}
return(MagickTrue);
}
| 0
|
256,136
|
inline void SparseMatMul<TL, TR>::SliceMatrix(
const MatrixR& mat, const int num_rows, const int num_slices,
std::vector<typename SparseMatMul<TL, TR>::ConstMatrixMapR*>* slices) {
slices->resize(num_slices);
DSizes d(num_rows, mat.dimension(1));
DCHECK_LE(num_rows * num_slices, mat.dimension(0));
for (int i = 0; i < num_slices; ++i) {
(*slices)[i] = new ConstMatrixMapR(&mat(i * num_rows, 0), d);
}
}
| 0
|
256,995
|
static int route4_set_parms(struct net *net, struct tcf_proto *tp,
unsigned long base, struct route4_filter *f,
u32 handle, struct route4_head *head,
struct nlattr **tb, struct nlattr *est, int new,
u32 flags, struct netlink_ext_ack *extack)
{
u32 id = 0, to = 0, nhandle = 0x8000;
struct route4_filter *fp;
unsigned int h1;
struct route4_bucket *b;
int err;
err = tcf_exts_validate(net, tp, tb, est, &f->exts, flags, extack);
if (err < 0)
return err;
if (tb[TCA_ROUTE4_TO]) {
if (new && handle & 0x8000)
return -EINVAL;
to = nla_get_u32(tb[TCA_ROUTE4_TO]);
if (to > 0xFF)
return -EINVAL;
nhandle = to;
}
if (tb[TCA_ROUTE4_FROM]) {
if (tb[TCA_ROUTE4_IIF])
return -EINVAL;
id = nla_get_u32(tb[TCA_ROUTE4_FROM]);
if (id > 0xFF)
return -EINVAL;
nhandle |= id << 16;
} else if (tb[TCA_ROUTE4_IIF]) {
id = nla_get_u32(tb[TCA_ROUTE4_IIF]);
if (id > 0x7FFF)
return -EINVAL;
nhandle |= (id | 0x8000) << 16;
} else
nhandle |= 0xFFFF << 16;
if (handle && new) {
nhandle |= handle & 0x7F00;
if (nhandle != handle)
return -EINVAL;
}
h1 = to_hash(nhandle);
b = rtnl_dereference(head->table[h1]);
if (!b) {
b = kzalloc(sizeof(struct route4_bucket), GFP_KERNEL);
if (b == NULL)
return -ENOBUFS;
rcu_assign_pointer(head->table[h1], b);
} else {
unsigned int h2 = from_hash(nhandle >> 16);
for (fp = rtnl_dereference(b->ht[h2]);
fp;
fp = rtnl_dereference(fp->next))
if (fp->handle == f->handle)
return -EEXIST;
}
if (tb[TCA_ROUTE4_TO])
f->id = to;
if (tb[TCA_ROUTE4_FROM])
f->id = to | id<<16;
else if (tb[TCA_ROUTE4_IIF])
f->iif = id;
f->handle = nhandle;
f->bkt = b;
f->tp = tp;
if (tb[TCA_ROUTE4_CLASSID]) {
f->res.classid = nla_get_u32(tb[TCA_ROUTE4_CLASSID]);
tcf_bind_filter(tp, &f->res, base);
}
return 0;
}
| 0
|
292,202
|
inbound_banlist (session *sess, time_t stamp, char *chan, char *mask,
char *banner, int rplcode, const message_tags_data *tags_data)
{
char *time_str = ctime (&stamp);
server *serv = sess->server;
char *nl;
if (stamp <= 0)
{
time_str = "";
}
else
{
if ((nl = strchr (time_str, '\n')))
*nl = 0;
}
sess = find_channel (serv, chan);
if (!sess)
{
sess = serv->front_session;
goto nowindow;
}
if (!fe_add_ban_list (sess, mask, banner, time_str, rplcode))
{
nowindow:
EMIT_SIGNAL_TIMESTAMP (XP_TE_BANLIST, sess, chan, mask, banner, time_str,
0, tags_data->timestamp);
return TRUE;
}
return TRUE;
}
| 0
|
236,203
|
GF_Box *twrp_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TextWrapBox, GF_ISOM_BOX_TYPE_TWRP);
return (GF_Box *) tmp;
}
| 0
|
262,020
|
ServiceProtoHandleConnection(ServiceConnection *conn,
ProtoRequest *req)
{
VGAuthError err = VGAUTH_E_OK;
VGAuthError err2;
gchar *packet;
char *event = NULL;
#ifdef _WIN32
err = ServiceStartVerifyPid(conn, req->reqData.connect.pid, &event);
#endif
if (err != VGAUTH_E_OK) {
/* Value of err is always VGAUTH_E_OK on non-Windows platforms */
/* coverity[dead_error_line] */
packet = Proto_MakeErrorReply(conn, req, err, "connect failed");
} else {
/* Value of event is always NULL on non-Windows platforms */
/* coverity[dead_error_line] */
packet = g_markup_printf_escaped(VGAUTH_CONNECT_REPLY_FORMAT,
req->sequenceNumber,
event ? event : "");
}
err2 = ServiceNetworkWriteData(conn, strlen(packet), packet);
if (err2 != VGAUTH_E_OK) {
Warning("%s: failed to send Connect reply\n", __FUNCTION__);
if (err == VGAUTH_E_OK) {
err = err2;
}
}
g_free(packet);
g_free(event);
return err;
}
| 0
|
265,048
|
set_default_colour_sequences(void)
{
fg_bg_sequences[COL_SEQ_FG].start = ztrdup(TC_COL_FG_START);
fg_bg_sequences[COL_SEQ_FG].end = ztrdup(TC_COL_FG_END);
fg_bg_sequences[COL_SEQ_FG].def = ztrdup(TC_COL_FG_DEFAULT);
fg_bg_sequences[COL_SEQ_BG].start = ztrdup(TC_COL_BG_START);
fg_bg_sequences[COL_SEQ_BG].end = ztrdup(TC_COL_BG_END);
fg_bg_sequences[COL_SEQ_BG].def = ztrdup(TC_COL_BG_DEFAULT);
}
| 0
|
252,309
|
static void wav2Encode(
unsigned short *in, // io: values are transformed in place
int nx, // i : x size
int ox, // i : x offset
int ny, // i : y size
int oy, // i : y offset
unsigned short mx) // i : maximum in[x][y] value
{
bool w14 = (mx < (1 << 14));
int n = (nx > ny) ? ny : nx;
int p = 1; // == 1 << level
int p2 = 2; // == 1 << (level+1)
//
// Hierachical loop on smaller dimension n
//
while (p2 <= n) {
unsigned short *py = in;
unsigned short *ey = in + oy * (ny - p2);
int oy1 = oy * p;
int oy2 = oy * p2;
int ox1 = ox * p;
int ox2 = ox * p2;
unsigned short i00, i01, i10, i11;
//
// Y loop
//
for (; py <= ey; py += oy2) {
unsigned short *px = py;
unsigned short *ex = py + ox * (nx - p2);
//
// X loop
//
for (; px <= ex; px += ox2) {
unsigned short *p01 = px + ox1;
unsigned short *p10 = px + oy1;
unsigned short *p11 = p10 + ox1;
//
// 2D wavelet encoding
//
if (w14) {
wenc14(*px, *p01, i00, i01);
wenc14(*p10, *p11, i10, i11);
wenc14(i00, i10, *px, *p10);
wenc14(i01, i11, *p01, *p11);
} else {
wenc16(*px, *p01, i00, i01);
wenc16(*p10, *p11, i10, i11);
wenc16(i00, i10, *px, *p10);
wenc16(i01, i11, *p01, *p11);
}
}
//
// Encode (1D) odd column (still in Y loop)
//
if (nx & p) {
unsigned short *p10 = px + oy1;
if (w14)
wenc14(*px, *p10, i00, *p10);
else
wenc16(*px, *p10, i00, *p10);
*px = i00;
}
}
//
// Encode (1D) odd line (must loop in X)
//
if (ny & p) {
unsigned short *px = py;
unsigned short *ex = py + ox * (nx - p2);
for (; px <= ex; px += ox2) {
unsigned short *p01 = px + ox1;
if (w14)
wenc14(*px, *p01, i00, *p01);
else
wenc16(*px, *p01, i00, *p01);
*px = i00;
}
}
//
// Next level
//
p = p2;
p2 <<= 1;
}
}
| 0
|
232,345
|
GF_TrackBox *gf_isom_get_track_from_file(GF_ISOFile *movie, u32 trackNumber)
{
GF_TrackBox *trak;
if (!movie) return NULL;
trak = gf_isom_get_track(movie->moov, trackNumber);
if (!trak) movie->LastError = GF_BAD_PARAM;
return trak;
}
| 0
|
459,119
|
static bool tcf_proto_cmp(const struct tcf_proto *tp1,
const struct tcf_proto *tp2)
{
return tp1->chain->index == tp2->chain->index &&
tp1->prio == tp2->prio &&
tp1->protocol == tp2->protocol;
}
| 0
|
454,751
|
static int ismt_process_desc(const struct ismt_desc *desc,
union i2c_smbus_data *data,
struct ismt_priv *priv, int size,
char read_write)
{
u8 *dma_buffer = PTR_ALIGN(&priv->buffer[0], 16);
dev_dbg(&priv->pci_dev->dev, "Processing completed descriptor\n");
__ismt_desc_dump(&priv->pci_dev->dev, desc);
ismt_gen_reg_dump(priv);
ismt_mstr_reg_dump(priv);
if (desc->status & ISMT_DESC_SCS) {
if (read_write == I2C_SMBUS_WRITE &&
size != I2C_SMBUS_PROC_CALL &&
size != I2C_SMBUS_BLOCK_PROC_CALL)
return 0;
switch (size) {
case I2C_SMBUS_BYTE:
case I2C_SMBUS_BYTE_DATA:
data->byte = dma_buffer[0];
break;
case I2C_SMBUS_WORD_DATA:
case I2C_SMBUS_PROC_CALL:
data->word = dma_buffer[0] | (dma_buffer[1] << 8);
break;
case I2C_SMBUS_BLOCK_DATA:
case I2C_SMBUS_BLOCK_PROC_CALL:
if (desc->rxbytes != dma_buffer[0] + 1)
return -EMSGSIZE;
memcpy(data->block, dma_buffer, desc->rxbytes);
break;
case I2C_SMBUS_I2C_BLOCK_DATA:
memcpy(&data->block[1], dma_buffer, desc->rxbytes);
data->block[0] = desc->rxbytes;
break;
}
return 0;
}
if (likely(desc->status & ISMT_DESC_NAK))
return -ENXIO;
if (desc->status & ISMT_DESC_CRC)
return -EBADMSG;
if (desc->status & ISMT_DESC_COL)
return -EAGAIN;
if (desc->status & ISMT_DESC_LPR)
return -EPROTO;
if (desc->status & (ISMT_DESC_DLTO | ISMT_DESC_CLTO))
return -ETIMEDOUT;
return -EIO;
}
| 0
|
225,919
|
GF_Err name_box_read(GF_Box *s, GF_BitStream *bs)
{
u32 length;
GF_NameBox *ptr = (GF_NameBox *)s;
length = (u32) (ptr->size);
if (length >= (u32)0xFFFFFFFF) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid length %lu in name box\n", length));
return GF_ISOM_INVALID_FILE;
}
ptr->string = (char*)gf_malloc(sizeof(char) * (length+1));
if (! ptr->string) return GF_OUT_OF_MEM;
gf_bs_read_data(bs, ptr->string, length);
ptr->string[length] = 0;
return GF_OK;
}
| 0
|
359,360
|
peer_aslist_set_vty (struct vty *vty, const char *ip_str,
afi_t afi, safi_t safi,
const char *name_str, const char *direct_str)
{
int ret;
struct peer *peer;
int direct = FILTER_IN;
peer = peer_and_group_lookup_vty (vty, ip_str);
if (! peer)
return CMD_WARNING;
/* Check filter direction. */
if (strncmp (direct_str, "i", 1) == 0)
direct = FILTER_IN;
else if (strncmp (direct_str, "o", 1) == 0)
direct = FILTER_OUT;
ret = peer_aslist_set (peer, afi, safi, direct, name_str);
return bgp_vty_return (vty, ret);
}
| 0
|
317,206
|
static int selinux_secmark_relabel_packet(u32 sid)
{
const struct task_security_struct *__tsec;
u32 tsid;
__tsec = selinux_cred(current_cred());
tsid = __tsec->sid;
return avc_has_perm(&selinux_state,
tsid, sid, SECCLASS_PACKET, PACKET__RELABELTO,
NULL);
}
| 0
|
195,038
|
mrb_ary_shift_m(mrb_state *mrb, mrb_value self)
{
struct RArray *a = mrb_ary_ptr(self);
mrb_int len = ARY_LEN(a);
mrb_int n;
mrb_value val;
if (mrb_get_args(mrb, "|i", &n) == 0) {
return mrb_ary_shift(mrb, self);
};
ary_modify_check(mrb, a);
if (len == 0 || n == 0) return mrb_ary_new(mrb);
if (n < 0) mrb_raise(mrb, E_ARGUMENT_ERROR, "negative array shift");
if (n > len) n = len;
val = mrb_ary_new_from_values(mrb, n, ARY_PTR(a));
if (ARY_SHARED_P(a)) {
L_SHIFT:
a->as.heap.ptr+=n;
a->as.heap.len-=n;
return val;
}
if (len > ARY_SHIFT_SHARED_MIN) {
ary_make_shared(mrb, a);
goto L_SHIFT;
}
else if (len == n) {
ARY_SET_LEN(a, 0);
}
else {
mrb_value *ptr = ARY_PTR(a);
mrb_int size = len-n;
while (size--) {
*ptr = *(ptr+n);
++ptr;
}
ARY_SET_LEN(a, len-n);
}
return val;
}
| 1
|
231,662
|
bool getDisableMigration() override {
return false;
}
| 0
|
220,413
|
mrb_ary_reverse(mrb_state *mrb, mrb_value self)
{
struct RArray *a = mrb_ary_ptr(self), *b = ary_new_capa(mrb, ARY_LEN(a));
mrb_int len = ARY_LEN(a);
if (len > 0) {
mrb_value *p1, *p2, *e;
p1 = ARY_PTR(a);
e = p1 + len;
p2 = ARY_PTR(b) + len - 1;
while (p1 < e) {
*p2-- = *p1++;
}
ARY_SET_LEN(b, len);
}
return mrb_obj_value(b);
}
| 0
|
436,140
|
static void io_flush_timeouts(struct io_ring_ctx *ctx)
{
u32 seq = ctx->cached_cq_tail - atomic_read(&ctx->cq_timeouts);
while (!list_empty(&ctx->timeout_list)) {
u32 events_needed, events_got;
struct io_kiocb *req = list_first_entry(&ctx->timeout_list,
struct io_kiocb, timeout.list);
if (io_is_timeout_noseq(req))
break;
/*
* Since seq can easily wrap around over time, subtract
* the last seq at which timeouts were flushed before comparing.
* Assuming not more than 2^31-1 events have happened since,
* these subtractions won't have wrapped, so we can check if
* target is in [last_seq, current_seq] by comparing the two.
*/
events_needed = req->timeout.target_seq - ctx->cq_last_tm_flush;
events_got = seq - ctx->cq_last_tm_flush;
if (events_got < events_needed)
break;
list_del_init(&req->timeout.list);
io_kill_timeout(req, 0);
}
ctx->cq_last_tm_flush = seq;
}
| 0
|
269,330
|
void Compute(OpKernelContext* context) override {
// Here's the basic idea:
// Batch and depth dimension are independent from row and col dimension. And
// because FractionalAvgPool currently only support pooling along row and
// col, we can basically think of this 4D tensor backpropagation as
// operation of a series of 2D planes.
//
// For each element of a 'slice' (2D plane) of output_backprop, we need to
// figure out its contributors when doing FractionalAvgPool operation. This
// can be done based on row_pooling_sequence, col_pooling_seq and
// overlapping.
// Once we figure out the original contributors, we just need to evenly
// divide the value of this element among these contributors.
//
// Internally, we divide the out_backprop tensor and store it in a temporary
// tensor of double type. And cast it to the corresponding type.
typedef Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>
ConstEigenMatrixMap;
typedef Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>>
EigenDoubleMatrixMap;
// Grab the inputs.
const Tensor& orig_input_tensor_shape = context->input(0);
OP_REQUIRES(context,
orig_input_tensor_shape.dims() == 1 &&
orig_input_tensor_shape.NumElements() == 4,
errors::InvalidArgument("original input tensor shape must be"
"1-dimensional and 4 elements"));
const Tensor& out_backprop = context->input(1);
const Tensor& row_seq_tensor = context->input(2);
const Tensor& col_seq_tensor = context->input(3);
const int64_t out_batch = out_backprop.dim_size(0);
const int64_t out_rows = out_backprop.dim_size(1);
const int64_t out_cols = out_backprop.dim_size(2);
const int64_t out_depth = out_backprop.dim_size(3);
OP_REQUIRES(context, row_seq_tensor.NumElements() > out_rows,
errors::InvalidArgument("Given out_backprop shape ",
out_backprop.shape().DebugString(),
", row_seq_tensor must have at least ",
out_rows + 1, " elements, but got ",
row_seq_tensor.NumElements()));
OP_REQUIRES(context, col_seq_tensor.NumElements() > out_cols,
errors::InvalidArgument("Given out_backprop shape ",
out_backprop.shape().DebugString(),
", col_seq_tensor must have at least ",
out_cols + 1, " elements, but got ",
col_seq_tensor.NumElements()));
auto row_seq_tensor_flat = row_seq_tensor.flat<int64>();
auto col_seq_tensor_flat = col_seq_tensor.flat<int64>();
auto orig_input_tensor_shape_flat = orig_input_tensor_shape.flat<int64>();
const int64_t in_batch = orig_input_tensor_shape_flat(0);
const int64_t in_rows = orig_input_tensor_shape_flat(1);
const int64_t in_cols = orig_input_tensor_shape_flat(2);
const int64_t in_depth = orig_input_tensor_shape_flat(3);
OP_REQUIRES(
context, in_batch != 0,
errors::InvalidArgument("Batch dimension of input must not be 0"));
OP_REQUIRES(
context, in_rows != 0,
errors::InvalidArgument("Rows dimension of input must not be 0"));
OP_REQUIRES(
context, in_cols != 0,
errors::InvalidArgument("Columns dimension of input must not be 0"));
OP_REQUIRES(
context, in_depth != 0,
errors::InvalidArgument("Depth dimension of input must not be 0"));
constexpr int tensor_in_and_out_dims = 4;
// Transform orig_input_tensor_shape into TensorShape
TensorShape in_shape;
for (auto i = 0; i < tensor_in_and_out_dims; ++i) {
in_shape.AddDim(orig_input_tensor_shape_flat(i));
}
// Create intermediate in_backprop.
Tensor in_backprop_tensor_temp;
OP_REQUIRES_OK(context, context->forward_input_or_allocate_temp(
{0}, DataTypeToEnum<double>::v(), in_shape,
&in_backprop_tensor_temp));
in_backprop_tensor_temp.flat<double>().setZero();
// Transform 4D tensor to 2D matrix.
EigenDoubleMatrixMap in_backprop_tensor_temp_mat(
in_backprop_tensor_temp.flat<double>().data(), in_depth,
in_cols * in_rows * in_batch);
ConstEigenMatrixMap out_backprop_mat(out_backprop.flat<T>().data(),
out_depth,
out_cols * out_rows * out_batch);
// Loop through each element of out_backprop and evenly distribute the
// element to the corresponding pooling cell.
const int64_t in_max_row_index = in_rows - 1;
const int64_t in_max_col_index = in_cols - 1;
for (int64_t b = 0; b < out_batch; ++b) {
for (int64_t r = 0; r < out_rows; ++r) {
const int64_t in_row_start = row_seq_tensor_flat(r);
int64_t in_row_end = overlapping_ ? row_seq_tensor_flat(r + 1)
: row_seq_tensor_flat(r + 1) - 1;
in_row_end = std::min(in_row_end, in_max_row_index);
for (int64_t c = 0; c < out_cols; ++c) {
const int64_t in_col_start = col_seq_tensor_flat(c);
int64_t in_col_end = overlapping_ ? col_seq_tensor_flat(c + 1)
: col_seq_tensor_flat(c + 1) - 1;
in_col_end = std::min(in_col_end, in_max_col_index);
const int64_t num_elements_in_pooling_cell =
(in_row_end - in_row_start + 1) * (in_col_end - in_col_start + 1);
const int64_t out_index = (b * out_rows + r) * out_cols + c;
// Now we can evenly distribute out_backprop(b, h, w, *) to
// in_backprop(b, hs:he, ws:we, *).
for (int64_t in_r = in_row_start; in_r <= in_row_end; ++in_r) {
for (int64_t in_c = in_col_start; in_c <= in_col_end; ++in_c) {
const int64_t in_index = (b * in_rows + in_r) * in_cols + in_c;
// Walk through each channel (depth).
for (int64_t d = 0; d < out_depth; ++d) {
const double out_backprop_element = static_cast<double>(
out_backprop_mat.coeffRef(d, out_index));
double& in_backprop_ref =
in_backprop_tensor_temp_mat.coeffRef(d, in_index);
in_backprop_ref +=
out_backprop_element / num_elements_in_pooling_cell;
}
}
}
}
}
}
// Depending on the type, cast double to type T.
Tensor* in_backprop_tensor = nullptr;
OP_REQUIRES_OK(context, context->forward_input_or_allocate_output(
{0}, 0, in_shape, &in_backprop_tensor));
auto in_backprop_tensor_flat = in_backprop_tensor->flat<T>();
auto in_backprop_tensor_temp_flat = in_backprop_tensor_temp.flat<double>();
for (int64_t i = 0; i < in_backprop_tensor_flat.size(); ++i) {
in_backprop_tensor_flat(i) =
static_cast<T>(in_backprop_tensor_temp_flat(i));
}
}
| 0
|
209,927
|
static void agent_connect(UdscsConnection *conn)
{
struct agent_data *agent_data;
agent_data = g_new0(struct agent_data, 1);
GError *err = NULL;
if (session_info) {
PidUid pid_uid = vdagent_connection_get_peer_pid_uid(VDAGENT_CONNECTION(conn), &err);
if (err || pid_uid.pid <= 0) {
static const char msg[] = "Could not get peer PID, disconnecting new client";
if (err) {
syslog(LOG_ERR, "%s: %s", msg, err->message);
g_error_free(err);
} else {
syslog(LOG_ERR, "%s", msg);
}
agent_data_destroy(agent_data);
udscs_server_destroy_connection(server, conn);
return;
}
agent_data->session = session_info_session_for_pid(session_info, pid_uid.pid);
uid_t session_uid = session_info_uid_for_session(session_info, agent_data->session);
/* Check that the UID of the PID did not change, this should be done after
* computing the session to avoid race conditions.
* This can happen as vdagent_connection_get_peer_pid_uid get information
* from the time of creating the socket, but the process in the meantime
* have been replaced */
if (!check_uid_of_pid(pid_uid.pid, pid_uid.uid) ||
/* Check that the user launching the Agent is the same as session one
* or root user.
* This prevents session hijacks from other users. */
(pid_uid.uid != 0 && pid_uid.uid != session_uid)) {
syslog(LOG_ERR, "UID mismatch: UID=%u PID=%u suid=%u", pid_uid.uid,
pid_uid.pid, session_uid);
agent_data_destroy(agent_data);
udscs_server_destroy_connection(server, conn);
return;
}
}
g_object_set_data_full(G_OBJECT(conn), "agent_data", agent_data,
(GDestroyNotify) agent_data_destroy);
udscs_write(conn, VDAGENTD_VERSION, 0, 0,
(uint8_t *)VERSION, strlen(VERSION) + 1);
update_active_session_connection(conn);
if (device_info) {
forward_data_to_session_agent(VDAGENTD_GRAPHICS_DEVICE_INFO,
(uint8_t *) device_info, device_info_size);
}
}
| 1
|
222,846
|
bool AllOutputShapesKnown(NodeContext* c) {
InferenceContext* ic = c->inference_context.get();
// Checks if all the output shapes are fully defined.
for (int i = 0; i < ic->num_outputs(); i++) {
if (!ic->FullyDefined(ic->output(i))) {
return false;
}
}
return true;
}
| 0
|
390,517
|
SetKeyExplicit(XkbSrvInfoPtr xkbi,xkbSetMapReq *req,CARD8 *wire,
XkbChangesPtr changes)
{
register unsigned i,first,last;
XkbServerMapPtr xkb = xkbi->desc->server;
CARD8 * start;
start= wire;
first= req->firstKeyExplicit;
last= req->firstKeyExplicit+req->nKeyExplicit-1;
bzero(&xkb->explicit[first],req->nKeyExplicit);
for (i=0;i<req->totalKeyExplicit;i++,wire+= 2) {
xkb->explicit[wire[0]]= wire[1];
}
if (first>0) {
if (changes->map.changed&XkbExplicitComponentsMask) {
int oldLast;
oldLast= changes->map.first_key_explicit+
changes->map.num_key_explicit-1;
if (changes->map.first_key_explicit<first)
first= changes->map.first_key_explicit;
if (oldLast>last)
last= oldLast;
}
changes->map.first_key_explicit= first;
changes->map.num_key_explicit= (last-first)+1;
}
wire+= XkbPaddedSize(wire-start)-(wire-start);
return (char *)wire;
}
| 0
|
216,515
|
int ssl3_get_new_session_ticket(SSL *s)
{
int ok, al, ret = 0, ticklen;
long n;
const unsigned char *p;
unsigned char *d;
n = s->method->ssl_get_message(s,
SSL3_ST_CR_SESSION_TICKET_A,
SSL3_ST_CR_SESSION_TICKET_B,
SSL3_MT_NEWSESSION_TICKET, 16384, &ok);
if (!ok)
return ((int)n);
if (n < 6) {
/* need at least ticket_lifetime_hint + ticket length */
al = SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, SSL_R_LENGTH_MISMATCH);
goto f_err;
}
p = d = (unsigned char *)s->init_msg;
n2l(p, s->session->tlsext_tick_lifetime_hint);
n2s(p, ticklen);
/* ticket_lifetime_hint + ticket_length + ticket */
if (ticklen + 6 != n) {
al = SSL_AD_DECODE_ERROR;
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, SSL_R_LENGTH_MISMATCH);
goto f_err;
}
if (s->session->tlsext_tick) {
OPENSSL_free(s->session->tlsext_tick);
s->session->tlsext_ticklen = 0;
}
s->session->tlsext_tick = OPENSSL_malloc(ticklen);
if (!s->session->tlsext_tick) {
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE);
goto err;
}
memcpy(s->session->tlsext_tick, p, ticklen);
s->session->tlsext_ticklen = ticklen;
/*
* There are two ways to detect a resumed ticket session. One is to set
* an appropriate session ID and then the server must return a match in
* ServerHello. This allows the normal client session ID matching to work
* and we know much earlier that the ticket has been accepted. The
* other way is to set zero length session ID when the ticket is
* presented and rely on the handshake to determine session resumption.
* We choose the former approach because this fits in with assumptions
* elsewhere in OpenSSL. The session ID is set to the SHA256 (or SHA1 is
* SHA256 is disabled) hash of the ticket.
*/
EVP_Digest(p, ticklen,
s->session->session_id, &s->session->session_id_length,
# ifndef OPENSSL_NO_SHA256
EVP_sha256(), NULL);
# else
EVP_sha1(), NULL);
# endif
ret = 1;
return (ret);
f_err:
ssl3_send_alert(s, SSL3_AL_FATAL, al);
err:
s->state = SSL_ST_ERR;
return (-1);
}
| 1
|
261,190
|
int MqttClient_Connect(MqttClient *client, MqttConnect *mc_connect)
{
int rc, len = 0;
/* Validate required arguments */
if (client == NULL || mc_connect == NULL) {
return MQTT_CODE_ERROR_BAD_ARG;
}
if (mc_connect->stat == MQTT_MSG_BEGIN) {
#ifdef WOLFMQTT_MULTITHREAD
/* Lock send socket mutex */
rc = wm_SemLock(&client->lockSend);
if (rc != 0) {
return rc;
}
#endif
#ifdef WOLFMQTT_V5
/* Use specified protocol version if set */
mc_connect->protocol_level = client->protocol_level;
#endif
/* Encode the connect packet */
rc = MqttEncode_Connect(client->tx_buf, client->tx_buf_len, mc_connect);
#ifdef WOLFMQTT_DEBUG_CLIENT
PRINTF("MqttClient_EncodePacket: Len %d, Type %s (%d), ID %d, QoS %d",
rc, MqttPacket_TypeDesc(MQTT_PACKET_TYPE_CONNECT),
MQTT_PACKET_TYPE_CONNECT, 0, 0);
#endif
if (rc <= 0) {
#ifdef WOLFMQTT_MULTITHREAD
wm_SemUnlock(&client->lockSend);
#endif
return rc;
}
len = rc;
#ifdef WOLFMQTT_MULTITHREAD
rc = wm_SemLock(&client->lockClient);
if (rc == 0) {
/* inform other threads of expected response */
rc = MqttClient_RespList_Add(client, MQTT_PACKET_TYPE_CONNECT_ACK,
0, &mc_connect->pendResp, &mc_connect->ack);
wm_SemUnlock(&client->lockClient);
}
if (rc != 0) {
wm_SemUnlock(&client->lockSend);
return rc; /* Error locking client */
}
#endif
/* Send connect packet */
rc = MqttPacket_Write(client, client->tx_buf, len);
#ifdef WOLFMQTT_MULTITHREAD
wm_SemUnlock(&client->lockSend);
#endif
if (rc != len) {
#ifdef WOLFMQTT_MULTITHREAD
if ((rc != MQTT_CODE_CONTINUE) &&
(wm_SemLock(&client->lockClient)) == 0) {
MqttClient_RespList_Remove(client, &mc_connect->pendResp);
wm_SemUnlock(&client->lockClient);
}
#endif
return rc;
}
#ifdef WOLFMQTT_V5
/* Enhanced authentication */
if (client->enable_eauth == 1) {
mc_connect->stat = MQTT_MSG_AUTH;
}
else
#endif
{
mc_connect->stat = MQTT_MSG_WAIT;
}
}
#ifdef WOLFMQTT_V5
/* Enhanced authentication */
if (mc_connect->protocol_level > MQTT_CONNECT_PROTOCOL_LEVEL_4 &&
mc_connect->stat == MQTT_MSG_AUTH)
{
MqttAuth auth, *p_auth = &auth;
MqttProp* prop, *conn_prop;
/* Find the AUTH property in the connect structure */
for (conn_prop = mc_connect->props;
(conn_prop != NULL) && (conn_prop->type != MQTT_PROP_AUTH_METHOD);
conn_prop = conn_prop->next) {
}
if (conn_prop == NULL) {
#ifdef WOLFMQTT_MULTITHREAD
if (wm_SemLock(&client->lockClient) == 0) {
MqttClient_RespList_Remove(client, &mc_connect->pendResp);
wm_SemUnlock(&client->lockClient);
}
#endif
/* AUTH property was not set in connect structure */
return MQTT_CODE_ERROR_BAD_ARG;
}
XMEMSET((void*)p_auth, 0, sizeof(MqttAuth));
/* Set the authentication reason */
p_auth->reason_code = MQTT_REASON_CONT_AUTH;
/* Use the same authentication method property from connect */
prop = MqttProps_Add(&p_auth->props);
prop->type = MQTT_PROP_AUTH_METHOD;
prop->data_str.str = conn_prop->data_str.str;
prop->data_str.len = conn_prop->data_str.len;
/* Send the AUTH packet */
rc = MqttClient_Auth(client, p_auth);
MqttClient_PropsFree(p_auth->props);
#ifdef WOLFMQTT_NONBLOCK
if (rc == MQTT_CODE_CONTINUE)
return rc;
#endif
if (rc != len) {
#ifdef WOLFMQTT_MULTITHREAD
if (wm_SemLock(&client->lockClient) == 0) {
MqttClient_RespList_Remove(client, &mc_connect->pendResp);
wm_SemUnlock(&client->lockClient);
}
#endif
return rc;
}
}
#endif /* WOLFMQTT_V5 */
/* Wait for connect ack packet */
rc = MqttClient_WaitType(client, &mc_connect->ack,
MQTT_PACKET_TYPE_CONNECT_ACK, 0, client->cmd_timeout_ms);
#ifdef WOLFMQTT_NONBLOCK
if (rc == MQTT_CODE_CONTINUE)
return rc;
#endif
#ifdef WOLFMQTT_MULTITHREAD
if (wm_SemLock(&client->lockClient) == 0) {
MqttClient_RespList_Remove(client, &mc_connect->pendResp);
wm_SemUnlock(&client->lockClient);
}
#endif
/* reset state */
mc_connect->stat = MQTT_MSG_BEGIN;
return rc;
}
| 0
|
262,023
|
ServiceProtoValidateSamlBearerToken(ServiceConnection *conn,
ProtoRequest *req)
{
VGAuthError err;
gchar *packet;
gchar *sPacket;
char *userName = NULL;
char *subjectName = NULL;
char *comment = NULL;
char *tokenStr = NULL;
ServiceAliasInfo *ai = NULL;
/*
* The validate code will do argument validation.
*/
err = SAML_VerifyBearerTokenAndChain(req->reqData.validateSamlBToken.samlToken,
req->reqData.validateSamlBToken.userName,
&userName,
&subjectName,
&ai);
#ifdef _WIN32
/*
* Only create a token in the non-info-only mode
*/
if ((err == VGAUTH_E_OK) &&
!req->reqData.validateSamlBToken.validateOnly) {
HANDLE userToken = NULL;
err = WinToken_GenerateTokenForUser(userName, &userToken);
if (err == VGAUTH_E_OK) {
tokenStr = ServiceDupHandleTo(conn->hProc, userToken);
if (!tokenStr) {
VGAUTH_LOG_WARNING("ServiceDupHandleTo() failed, user = %s",
userName);
err = VGAUTH_E_FAIL;
} else {
// close our copy after duping into client process
CloseHandle(userToken);
}
} else {
VGAUTH_LOG_WARNING("WinToken_GenerateTokenForUser() failed, user = %s",
userName);
}
} else {
Debug("%s: skipping token creation\n", __FUNCTION__);
}
#endif
if (err != VGAUTH_E_OK) {
Audit_Event(FALSE,
SU_(validate.samlBearer.fail,
"Validation of SAML bearer token failed: %d"),
(int) err); // localization code can't deal with
// differing types of uint64
/*
* Rewrite some errors to hide any data that could be useful to an
* attacker. Do this at this stage so that we still have
* useful debug and possibly auditing reasons.
*/
if (err == VGAUTH_E_INVALID_CERTIFICATE) {
err = VGAUTH_E_AUTHENTICATION_DENIED;
}
packet = Proto_MakeErrorReply(conn, req, err,
"validateSamlToken failed");
} else {
Audit_Event(FALSE,
SU_(validate.samlBearer.success,
"Validated SAML bearer token for user '%s'"),
userName);
/* Value of tokenStr is always NULL on non-Windows platforms */
/* coverity[dead_error_line] */
packet = g_markup_printf_escaped(VGAUTH_VALIDATESAMLBEARERTOKEN_REPLY_FORMAT_START,
req->sequenceNumber,
userName ? userName : "",
tokenStr ? tokenStr : "",
subjectName ? subjectName : "");
if (SUBJECT_TYPE_NAMED == ai->type) {
sPacket = g_markup_printf_escaped(VGAUTH_NAMEDALIASINFO_FORMAT,
ai->name,
ai->comment);
} else {
sPacket = g_markup_printf_escaped(VGAUTH_ANYALIASINFO_FORMAT,
ai->comment);
}
packet = Proto_ConcatXMLStrings(packet, sPacket);
packet = Proto_ConcatXMLStrings(packet,
g_strdup(VGAUTH_VALIDATESAMLBEARERTOKEN_REPLY_FORMAT_END));
}
err = ServiceNetworkWriteData(conn, strlen(packet), packet);
if (err != VGAUTH_E_OK) {
VGAUTH_LOG_WARNING("ServiceNetWorkWriteData() failed, pipe = %s", conn->pipeName);
goto done;
}
done:
g_free(userName);
g_free(subjectName);
g_free(packet);
g_free(comment);
g_free(tokenStr);
ServiceAliasFreeAliasInfo(ai);
return err;
}
| 0
|
338,074
|
void WasmBinaryBuilder::pushBlockElements(Block* curr,
Type type,
size_t start) {
assert(start <= expressionStack.size());
// The results of this block are the last values pushed to the expressionStack
Expression* results = nullptr;
if (type.isConcrete()) {
results = popTypedExpression(type);
}
if (expressionStack.size() < start) {
throwError("Block requires more values than are available");
}
// Everything else on the stack after `start` is either a none-type expression
// or a concretely-type expression that is implicitly dropped due to
// unreachability at the end of the block, like this:
//
// block i32
// i32.const 1
// i32.const 2
// i32.const 3
// return
// end
//
// The first two const elements will be emitted as drops in the block (the
// optimizer can remove them, of course, but in general we may need dropped
// items here as they may have side effects).
//
for (size_t i = start; i < expressionStack.size(); ++i) {
auto* item = expressionStack[i];
if (item->type.isConcrete()) {
item = Builder(wasm).makeDrop(item);
}
curr->list.push_back(item);
}
expressionStack.resize(start);
if (results != nullptr) {
curr->list.push_back(results);
}
}
| 0
|
432,279
|
MemTxResult flatview_read_continue(struct uc_struct *uc, FlatView *fv, hwaddr addr,
MemTxAttrs attrs, void *ptr,
hwaddr len, hwaddr addr1, hwaddr l,
MemoryRegion *mr)
{
uint8_t *ram_ptr;
uint64_t val;
MemTxResult result = MEMTX_OK;
bool release_lock = false;
uint8_t *buf = ptr;
for (;;) {
if (!memory_access_is_direct(mr, false)) {
/* I/O case */
release_lock |= prepare_mmio_access(mr);
l = memory_access_size(mr, l, addr1);
result |= memory_region_dispatch_read(uc, mr, addr1, &val,
size_memop(l), attrs);
stn_he_p(buf, l, val);
} else {
/* RAM case */
ram_ptr = qemu_ram_ptr_length(fv->root->uc, mr->ram_block, addr1, &l, false);
memcpy(buf, ram_ptr, l);
}
if (release_lock) {
release_lock = false;
}
len -= l;
buf += l;
addr += l;
if (!len) {
break;
}
l = len;
mr = flatview_translate(uc, fv, addr, &addr1, &l, false, attrs);
}
return result;
}
| 0
|
216,726
|
static int chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
void *ptr)
{
EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);
switch(type) {
case EVP_CTRL_INIT:
if (actx == NULL)
actx = ctx->cipher_data
= OPENSSL_zalloc(sizeof(*actx) + Poly1305_ctx_size());
if (actx == NULL) {
EVPerr(EVP_F_CHACHA20_POLY1305_CTRL, EVP_R_INITIALIZATION_ERROR);
return 0;
}
actx->len.aad = 0;
actx->len.text = 0;
actx->aad = 0;
actx->mac_inited = 0;
actx->tag_len = 0;
actx->nonce_len = 12;
actx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH;
memset(actx->tls_aad, 0, POLY1305_BLOCK_SIZE);
return 1;
case EVP_CTRL_COPY:
if (actx) {
EVP_CIPHER_CTX *dst = (EVP_CIPHER_CTX *)ptr;
dst->cipher_data =
OPENSSL_memdup(actx, sizeof(*actx) + Poly1305_ctx_size());
if (dst->cipher_data == NULL) {
EVPerr(EVP_F_CHACHA20_POLY1305_CTRL, EVP_R_COPY_ERROR);
return 0;
}
}
return 1;
case EVP_CTRL_AEAD_SET_IVLEN:
if (arg <= 0 || arg > CHACHA_CTR_SIZE)
return 0;
actx->nonce_len = arg;
return 1;
case EVP_CTRL_AEAD_SET_IV_FIXED:
if (arg != 12)
return 0;
actx->nonce[0] = actx->key.counter[1]
= CHACHA_U8TOU32((unsigned char *)ptr);
actx->nonce[1] = actx->key.counter[2]
= CHACHA_U8TOU32((unsigned char *)ptr+4);
actx->nonce[2] = actx->key.counter[3]
= CHACHA_U8TOU32((unsigned char *)ptr+8);
return 1;
case EVP_CTRL_AEAD_SET_TAG:
if (arg <= 0 || arg > POLY1305_BLOCK_SIZE)
return 0;
if (ptr != NULL) {
memcpy(actx->tag, ptr, arg);
actx->tag_len = arg;
}
return 1;
case EVP_CTRL_AEAD_GET_TAG:
if (arg <= 0 || arg > POLY1305_BLOCK_SIZE || !ctx->encrypt)
return 0;
memcpy(ptr, actx->tag, arg);
return 1;
case EVP_CTRL_AEAD_TLS1_AAD:
if (arg != EVP_AEAD_TLS1_AAD_LEN)
return 0;
{
unsigned int len;
unsigned char *aad = ptr;
memcpy(actx->tls_aad, ptr, EVP_AEAD_TLS1_AAD_LEN);
len = aad[EVP_AEAD_TLS1_AAD_LEN - 2] << 8 |
aad[EVP_AEAD_TLS1_AAD_LEN - 1];
aad = actx->tls_aad;
if (!ctx->encrypt) {
if (len < POLY1305_BLOCK_SIZE)
return 0;
len -= POLY1305_BLOCK_SIZE; /* discount attached tag */
aad[EVP_AEAD_TLS1_AAD_LEN - 2] = (unsigned char)(len >> 8);
aad[EVP_AEAD_TLS1_AAD_LEN - 1] = (unsigned char)len;
}
actx->tls_payload_length = len;
/*
* merge record sequence number as per RFC7905
*/
actx->key.counter[1] = actx->nonce[0];
actx->key.counter[2] = actx->nonce[1] ^ CHACHA_U8TOU32(aad);
actx->key.counter[3] = actx->nonce[2] ^ CHACHA_U8TOU32(aad+4);
actx->mac_inited = 0;
return POLY1305_BLOCK_SIZE; /* tag length */
}
case EVP_CTRL_AEAD_SET_MAC_KEY:
/* no-op */
return 1;
default:
return -1;
}
}
| 1
|
220,817
|
inline int LegacyHowManyThreads(int max_num_threads, int rows, int cols,
int depth) {
// Early-exit in the default case where multi-threading is disabled.
if (max_num_threads == 1) {
return 1;
}
// Ensure that each thread has KernelRows rows to process, if at all possible.
int thread_count = std::min(max_num_threads, rows / KernelRows);
// Limit the number of threads according to the overall size of the problem.
if (thread_count > 1) {
// Empirically determined value.
static constexpr std::uint64_t min_cubic_size_per_thread = 64 * 1024;
// We can only multiply two out of three sizes without risking overflow
const std::uint64_t cubic_size =
std::uint64_t(rows) * std::uint64_t(cols) * std::uint64_t(depth);
thread_count = std::min(
thread_count, static_cast<int>(cubic_size / min_cubic_size_per_thread));
}
if (thread_count < 1) {
thread_count = 1;
}
assert(thread_count > 0 && thread_count <= max_num_threads);
return thread_count;
}
| 0
|
338,195
|
bool WasmBinaryBuilder::getBasicHeapType(int64_t code, HeapType& out) {
switch (code) {
case BinaryConsts::EncodedHeapType::func:
out = HeapType::func;
return true;
case BinaryConsts::EncodedHeapType::extern_:
out = HeapType::ext;
return true;
case BinaryConsts::EncodedHeapType::any:
out = HeapType::any;
return true;
case BinaryConsts::EncodedHeapType::eq:
out = HeapType::eq;
return true;
case BinaryConsts::EncodedHeapType::i31:
out = HeapType::i31;
return true;
case BinaryConsts::EncodedHeapType::data:
out = HeapType::data;
return true;
default:
return false;
}
}
| 0
|
219,962
|
int callback_glewlwyd_set_user (const struct _u_request * request, struct _u_response * response, void * user_data) {
struct config_elements * config = (struct config_elements *)user_data;
json_t * j_user, * j_user_valid, * j_search_user;
j_search_user = get_user(config, u_map_get(request->map_url, "username"), u_map_get(request->map_url, "source"));
if (check_result_value(j_search_user, G_OK)) {
j_user = ulfius_get_json_body_request(request, NULL);
if (j_user != NULL) {
j_user_valid = is_user_valid(config, u_map_get(request->map_url, "username"), j_user, 0, json_string_value(json_object_get(json_object_get(j_search_user, "user"), "source")));
if (check_result_value(j_user_valid, G_OK)) {
if (set_user(config, u_map_get(request->map_url, "username"), j_user, json_string_value(json_object_get(json_object_get(j_search_user, "user"), "source"))) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_user - Error set_user");
response->status = 500;
} else {
y_log_message(Y_LOG_LEVEL_INFO, "Event - User '%s' updated", u_map_get(request->map_url, "username"));
}
} else if (check_result_value(j_user_valid, G_ERROR_PARAM)) {
if (json_object_get(j_user_valid, "error") != NULL) {
ulfius_set_json_body_response(response, 400, json_object_get(j_user_valid, "error"));
} else {
response->status = 400;
}
} else if (!check_result_value(j_user_valid, G_OK)) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_user - Error is_user_valid");
response->status = 500;
}
json_decref(j_user_valid);
} else {
response->status = 400;
}
json_decref(j_user);
} else if (check_result_value(j_search_user, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_set_user - Error get_user");
response->status = 500;
}
json_decref(j_search_user);
return U_CALLBACK_CONTINUE;
}
| 0
|
402,617
|
get_password(FILE *input, FILE *output, char *prompt, PRBool (*ok)(char *))
{
int infd = fileno(input);
char phrase[200];
size_t size = sizeof(phrase);
ingress();
memset(phrase, 0, size);
while(true) {
int rc;
print_prompt(input, output, prompt);
rc = read_password(input, output, phrase, size);
if (rc < 0)
return NULL;
if (!ok)
break;
if ((*ok)(phrase))
break;
if (!isatty(infd))
return NULL;
fprintf(output, "Password does not meet requirements.\n");
fflush(output);
}
egress();
return (char *)PORT_Strdup(phrase);
}
| 0
|
270,412
|
static inline uint32_t ok_inflater_peek_bits(ok_inflater *inflater, unsigned int num_bits) {
return inflater->input_buffer & ((1 << num_bits) - 1);
}
| 0
|
436,057
|
static void io_uring_clean_tctx(struct io_uring_task *tctx)
{
struct io_wq *wq = tctx->io_wq;
struct io_tctx_node *node;
unsigned long index;
xa_for_each(&tctx->xa, index, node)
io_uring_del_tctx_node(index);
if (wq) {
/*
* Must be after io_uring_del_task_file() (removes nodes under
* uring_lock) to avoid race with io_uring_try_cancel_iowq().
*/
tctx->io_wq = NULL;
io_wq_put_and_exit(wq);
}
| 0
|
521,496
|
ZipFile::OpenStreamCounter::~OpenStreamCounter()
{
/* If you hit this assertion, it means you've created a stream to read one of the items in the
zipfile, but you've forgotten to delete that stream object before deleting the file..
Streams can't be kept open after the file is deleted because they need to share the input
stream that is managed by the ZipFile object.
*/
jassert (numOpenStreams == 0);
}
| 0
|
409,417
|
check_for_codes_from_term(void)
{
int c;
// If no codes requested or all are answered, no need to wait.
if (xt_index_out == 0 || xt_index_out == xt_index_in)
return;
// Vgetc() will check for and handle any response.
// Keep calling vpeekc() until we don't get any responses.
++no_mapping;
++allow_keys;
for (;;)
{
c = vpeekc();
if (c == NUL) // nothing available
break;
// If a response is recognized it's replaced with K_IGNORE, must read
// it from the input stream. If there is no K_IGNORE we can't do
// anything, break here (there might be some responses further on, but
// we don't want to throw away any typed chars).
if (c != K_SPECIAL && c != K_IGNORE)
break;
c = vgetc();
if (c != K_IGNORE)
{
vungetc(c);
break;
}
}
--no_mapping;
--allow_keys;
}
| 0
|
291,825
|
static void rtrs_clt_path_down(struct rtrs_clt_path *clt_path)
{
struct rtrs_clt_sess *clt = clt_path->clt;
if (!clt_path->established)
return;
clt_path->established = false;
mutex_lock(&clt->paths_ev_mutex);
WARN_ON(!clt->paths_up);
if (--clt->paths_up == 0)
clt->link_ev(clt->priv, RTRS_CLT_LINK_EV_DISCONNECTED);
mutex_unlock(&clt->paths_ev_mutex);
}
| 0
|
293,537
|
PJ_DEF(int) pj_scan_strcmp( pj_scanner *scanner, const char *s, int len)
{
if (scanner->curptr + len > scanner->end) {
pj_scan_syntax_err(scanner);
return -1;
}
return strncmp(scanner->curptr, s, len);
}
| 0
|
414,933
|
static int
xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
xmlXPathStepOpPtr op,
xmlNodePtr * first, xmlNodePtr * last,
int toBool)
{
#define XP_TEST_HIT \
if (hasAxisRange != 0) { \
if (++pos == maxPos) { \
if (addNode(seq, cur) < 0) \
ctxt->error = XPATH_MEMORY_ERROR; \
goto axis_range_end; } \
} else { \
if (addNode(seq, cur) < 0) \
ctxt->error = XPATH_MEMORY_ERROR; \
if (breakOnFirstHit) goto first_hit; }
#define XP_TEST_HIT_NS \
if (hasAxisRange != 0) { \
if (++pos == maxPos) { \
hasNsNodes = 1; \
if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \
ctxt->error = XPATH_MEMORY_ERROR; \
goto axis_range_end; } \
} else { \
hasNsNodes = 1; \
if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \
ctxt->error = XPATH_MEMORY_ERROR; \
if (breakOnFirstHit) goto first_hit; }
xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value;
xmlXPathTestVal test = (xmlXPathTestVal) op->value2;
xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3;
const xmlChar *prefix = op->value4;
const xmlChar *name = op->value5;
const xmlChar *URI = NULL;
#ifdef DEBUG_STEP
int nbMatches = 0, prevMatches = 0;
#endif
int total = 0, hasNsNodes = 0;
/* The popped object holding the context nodes */
xmlXPathObjectPtr obj;
/* The set of context nodes for the node tests */
xmlNodeSetPtr contextSeq;
int contextIdx;
xmlNodePtr contextNode;
/* The final resulting node set wrt to all context nodes */
xmlNodeSetPtr outSeq;
/*
* The temporary resulting node set wrt 1 context node.
* Used to feed predicate evaluation.
*/
xmlNodeSetPtr seq;
xmlNodePtr cur;
/* First predicate operator */
xmlXPathStepOpPtr predOp;
int maxPos; /* The requested position() (when a "[n]" predicate) */
int hasPredicateRange, hasAxisRange, pos, size, newSize;
int breakOnFirstHit;
xmlXPathTraversalFunction next = NULL;
int (*addNode) (xmlNodeSetPtr, xmlNodePtr);
xmlXPathNodeSetMergeFunction mergeAndClear;
xmlNodePtr oldContextNode;
xmlXPathContextPtr xpctxt = ctxt->context;
CHECK_TYPE0(XPATH_NODESET);
obj = valuePop(ctxt);
/*
* Setup namespaces.
*/
if (prefix != NULL) {
URI = xmlXPathNsLookup(xpctxt, prefix);
if (URI == NULL) {
xmlXPathReleaseObject(xpctxt, obj);
XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR);
}
}
/*
* Setup axis.
*
* MAYBE FUTURE TODO: merging optimizations:
* - If the nodes to be traversed wrt to the initial nodes and
* the current axis cannot overlap, then we could avoid searching
* for duplicates during the merge.
* But the question is how/when to evaluate if they cannot overlap.
* Example: if we know that for two initial nodes, the one is
* not in the ancestor-or-self axis of the other, then we could safely
* avoid a duplicate-aware merge, if the axis to be traversed is e.g.
* the descendant-or-self axis.
*/
mergeAndClear = xmlXPathNodeSetMergeAndClear;
switch (axis) {
case AXIS_ANCESTOR:
first = NULL;
next = xmlXPathNextAncestor;
break;
case AXIS_ANCESTOR_OR_SELF:
first = NULL;
next = xmlXPathNextAncestorOrSelf;
break;
case AXIS_ATTRIBUTE:
first = NULL;
last = NULL;
next = xmlXPathNextAttribute;
mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls;
break;
case AXIS_CHILD:
last = NULL;
if (((test == NODE_TEST_NAME) || (test == NODE_TEST_ALL)) &&
(type == NODE_TYPE_NODE))
{
/*
* Optimization if an element node type is 'element'.
*/
next = xmlXPathNextChildElement;
} else
next = xmlXPathNextChild;
mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls;
break;
case AXIS_DESCENDANT:
last = NULL;
next = xmlXPathNextDescendant;
break;
case AXIS_DESCENDANT_OR_SELF:
last = NULL;
next = xmlXPathNextDescendantOrSelf;
break;
case AXIS_FOLLOWING:
last = NULL;
next = xmlXPathNextFollowing;
break;
case AXIS_FOLLOWING_SIBLING:
last = NULL;
next = xmlXPathNextFollowingSibling;
break;
case AXIS_NAMESPACE:
first = NULL;
last = NULL;
next = (xmlXPathTraversalFunction) xmlXPathNextNamespace;
mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls;
break;
case AXIS_PARENT:
first = NULL;
next = xmlXPathNextParent;
break;
case AXIS_PRECEDING:
first = NULL;
next = xmlXPathNextPrecedingInternal;
break;
case AXIS_PRECEDING_SIBLING:
first = NULL;
next = xmlXPathNextPrecedingSibling;
break;
case AXIS_SELF:
first = NULL;
last = NULL;
next = xmlXPathNextSelf;
mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls;
break;
}
#ifdef DEBUG_STEP
xmlXPathDebugDumpStepAxis(op,
(obj->nodesetval != NULL) ? obj->nodesetval->nodeNr : 0);
#endif
if (next == NULL) {
xmlXPathReleaseObject(xpctxt, obj);
return(0);
}
contextSeq = obj->nodesetval;
if ((contextSeq == NULL) || (contextSeq->nodeNr <= 0)) {
xmlXPathReleaseObject(xpctxt, obj);
valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL));
return(0);
}
/*
* Predicate optimization ---------------------------------------------
* If this step has a last predicate, which contains a position(),
* then we'll optimize (although not exactly "position()", but only
* the short-hand form, i.e., "[n]".
*
* Example - expression "/foo[parent::bar][1]":
*
* COLLECT 'child' 'name' 'node' foo -- op (we are here)
* ROOT -- op->ch1
* PREDICATE -- op->ch2 (predOp)
* PREDICATE -- predOp->ch1 = [parent::bar]
* SORT
* COLLECT 'parent' 'name' 'node' bar
* NODE
* ELEM Object is a number : 1 -- predOp->ch2 = [1]
*
*/
maxPos = 0;
predOp = NULL;
hasPredicateRange = 0;
hasAxisRange = 0;
if (op->ch2 != -1) {
/*
* There's at least one predicate. 16 == XPATH_OP_PREDICATE
*/
predOp = &ctxt->comp->steps[op->ch2];
if (xmlXPathIsPositionalPredicate(ctxt, predOp, &maxPos)) {
if (predOp->ch1 != -1) {
/*
* Use the next inner predicate operator.
*/
predOp = &ctxt->comp->steps[predOp->ch1];
hasPredicateRange = 1;
} else {
/*
* There's no other predicate than the [n] predicate.
*/
predOp = NULL;
hasAxisRange = 1;
}
}
}
breakOnFirstHit = ((toBool) && (predOp == NULL)) ? 1 : 0;
/*
* Axis traversal -----------------------------------------------------
*/
/*
* 2.3 Node Tests
* - For the attribute axis, the principal node type is attribute.
* - For the namespace axis, the principal node type is namespace.
* - For other axes, the principal node type is element.
*
* A node test * is true for any node of the
* principal node type. For example, child::* will
* select all element children of the context node
*/
oldContextNode = xpctxt->node;
addNode = xmlXPathNodeSetAddUnique;
outSeq = NULL;
seq = NULL;
contextNode = NULL;
contextIdx = 0;
while (((contextIdx < contextSeq->nodeNr) || (contextNode != NULL)) &&
(ctxt->error == XPATH_EXPRESSION_OK)) {
xpctxt->node = contextSeq->nodeTab[contextIdx++];
if (seq == NULL) {
seq = xmlXPathNodeSetCreate(NULL);
if (seq == NULL) {
total = 0;
goto error;
}
}
/*
* Traverse the axis and test the nodes.
*/
pos = 0;
cur = NULL;
hasNsNodes = 0;
do {
cur = next(ctxt, cur);
if (cur == NULL)
break;
/*
* QUESTION TODO: What does the "first" and "last" stuff do?
*/
if ((first != NULL) && (*first != NULL)) {
if (*first == cur)
break;
if (((total % 256) == 0) &&
#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON
(xmlXPathCmpNodesExt(*first, cur) >= 0))
#else
(xmlXPathCmpNodes(*first, cur) >= 0))
#endif
{
break;
}
}
if ((last != NULL) && (*last != NULL)) {
if (*last == cur)
break;
if (((total % 256) == 0) &&
#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON
(xmlXPathCmpNodesExt(cur, *last) >= 0))
#else
(xmlXPathCmpNodes(cur, *last) >= 0))
#endif
{
break;
}
}
total++;
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext, " %s", cur->name);
#endif
switch (test) {
case NODE_TEST_NONE:
total = 0;
STRANGE
goto error;
case NODE_TEST_TYPE:
/*
* TODO: Don't we need to use
* xmlXPathNodeSetAddNs() for namespace nodes here?
* Surprisingly, some c14n tests fail, if we do this.
*/
if (type == NODE_TYPE_NODE) {
switch (cur->type) {
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
#endif
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
case XML_NAMESPACE_DECL:
XP_TEST_HIT
break;
default:
break;
}
} else if (cur->type == type) {
if (cur->type == XML_NAMESPACE_DECL)
XP_TEST_HIT_NS
else
XP_TEST_HIT
} else if ((type == NODE_TYPE_TEXT) &&
(cur->type == XML_CDATA_SECTION_NODE))
{
XP_TEST_HIT
}
break;
case NODE_TEST_PI:
if ((cur->type == XML_PI_NODE) &&
((name == NULL) || xmlStrEqual(name, cur->name)))
{
XP_TEST_HIT
}
break;
case NODE_TEST_ALL:
if (axis == AXIS_ATTRIBUTE) {
if (cur->type == XML_ATTRIBUTE_NODE)
{
if (prefix == NULL)
{
XP_TEST_HIT
} else if ((cur->ns != NULL) &&
(xmlStrEqual(URI, cur->ns->href)))
{
XP_TEST_HIT
}
}
} else if (axis == AXIS_NAMESPACE) {
if (cur->type == XML_NAMESPACE_DECL)
{
XP_TEST_HIT_NS
}
} else {
if (cur->type == XML_ELEMENT_NODE) {
if (prefix == NULL)
{
XP_TEST_HIT
} else if ((cur->ns != NULL) &&
(xmlStrEqual(URI, cur->ns->href)))
{
XP_TEST_HIT
}
}
}
break;
case NODE_TEST_NS:{
TODO;
break;
}
case NODE_TEST_NAME:
if (axis == AXIS_ATTRIBUTE) {
if (cur->type != XML_ATTRIBUTE_NODE)
break;
} else if (axis == AXIS_NAMESPACE) {
if (cur->type != XML_NAMESPACE_DECL)
break;
} else {
if (cur->type != XML_ELEMENT_NODE)
break;
}
switch (cur->type) {
case XML_ELEMENT_NODE:
if (xmlStrEqual(name, cur->name)) {
if (prefix == NULL) {
if (cur->ns == NULL)
{
XP_TEST_HIT
}
} else {
if ((cur->ns != NULL) &&
(xmlStrEqual(URI, cur->ns->href)))
{
XP_TEST_HIT
}
}
}
break;
case XML_ATTRIBUTE_NODE:{
xmlAttrPtr attr = (xmlAttrPtr) cur;
if (xmlStrEqual(name, attr->name)) {
if (prefix == NULL) {
if ((attr->ns == NULL) ||
(attr->ns->prefix == NULL))
{
XP_TEST_HIT
}
} else {
if ((attr->ns != NULL) &&
(xmlStrEqual(URI,
attr->ns->href)))
{
XP_TEST_HIT
}
}
}
break;
}
case XML_NAMESPACE_DECL:
if (cur->type == XML_NAMESPACE_DECL) {
xmlNsPtr ns = (xmlNsPtr) cur;
if ((ns->prefix != NULL) && (name != NULL)
&& (xmlStrEqual(ns->prefix, name)))
{
XP_TEST_HIT_NS
}
}
break;
default:
break;
}
break;
} /* switch(test) */
} while ((cur != NULL) && (ctxt->error == XPATH_EXPRESSION_OK));
goto apply_predicates;
axis_range_end: /* ----------------------------------------------------- */
/*
* We have a "/foo[n]", and position() = n was reached.
* Note that we can have as well "/foo/::parent::foo[1]", so
* a duplicate-aware merge is still needed.
* Merge with the result.
*/
if (outSeq == NULL) {
outSeq = seq;
seq = NULL;
} else
outSeq = mergeAndClear(outSeq, seq, 0);
/*
* Break if only a true/false result was requested.
*/
if (toBool)
break;
continue;
first_hit: /* ---------------------------------------------------------- */
/*
* Break if only a true/false result was requested and
* no predicates existed and a node test succeeded.
*/
if (outSeq == NULL) {
outSeq = seq;
seq = NULL;
} else
outSeq = mergeAndClear(outSeq, seq, 0);
break;
#ifdef DEBUG_STEP
if (seq != NULL)
nbMatches += seq->nodeNr;
#endif
apply_predicates: /* --------------------------------------------------- */
if (ctxt->error != XPATH_EXPRESSION_OK)
goto error;
/*
* Apply predicates.
*/
if ((predOp != NULL) && (seq->nodeNr > 0)) {
/*
* E.g. when we have a "/foo[some expression][n]".
*/
/*
* QUESTION TODO: The old predicate evaluation took into
* account location-sets.
* (E.g. ctxt->value->type == XPATH_LOCATIONSET)
* Do we expect such a set here?
* All what I learned now from the evaluation semantics
* does not indicate that a location-set will be processed
* here, so this looks OK.
*/
/*
* Iterate over all predicates, starting with the outermost
* predicate.
* TODO: Problem: we cannot execute the inner predicates first
* since we cannot go back *up* the operator tree!
* Options we have:
* 1) Use of recursive functions (like is it currently done
* via xmlXPathCompOpEval())
* 2) Add a predicate evaluation information stack to the
* context struct
* 3) Change the way the operators are linked; we need a
* "parent" field on xmlXPathStepOp
*
* For the moment, I'll try to solve this with a recursive
* function: xmlXPathCompOpEvalPredicate().
*/
size = seq->nodeNr;
if (hasPredicateRange != 0)
newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt,
predOp, seq, size, maxPos, maxPos, hasNsNodes);
else
newSize = xmlXPathCompOpEvalPredicate(ctxt,
predOp, seq, size, hasNsNodes);
if (ctxt->error != XPATH_EXPRESSION_OK) {
total = 0;
goto error;
}
/*
* Add the filtered set of nodes to the result node set.
*/
if (newSize == 0) {
/*
* The predicates filtered all nodes out.
*/
xmlXPathNodeSetClear(seq, hasNsNodes);
} else if (seq->nodeNr > 0) {
/*
* Add to result set.
*/
if (outSeq == NULL) {
if (size != newSize) {
/*
* We need to merge and clear here, since
* the sequence will contained NULLed entries.
*/
outSeq = mergeAndClear(NULL, seq, 1);
} else {
outSeq = seq;
seq = NULL;
}
} else
outSeq = mergeAndClear(outSeq, seq,
(size != newSize) ? 1: 0);
/*
* Break if only a true/false result was requested.
*/
if (toBool)
break;
}
} else if (seq->nodeNr > 0) {
/*
* Add to result set.
*/
if (outSeq == NULL) {
outSeq = seq;
seq = NULL;
} else {
outSeq = mergeAndClear(outSeq, seq, 0);
}
}
}
error:
if ((obj->boolval) && (obj->user != NULL)) {
/*
* QUESTION TODO: What does this do and why?
* TODO: Do we have to do this also for the "error"
* cleanup further down?
*/
ctxt->value->boolval = 1;
ctxt->value->user = obj->user;
obj->user = NULL;
obj->boolval = 0;
}
xmlXPathReleaseObject(xpctxt, obj);
/*
* Ensure we return at least an emtpy set.
*/
if (outSeq == NULL) {
if ((seq != NULL) && (seq->nodeNr == 0))
outSeq = seq;
else
outSeq = xmlXPathNodeSetCreate(NULL);
/* XXX what if xmlXPathNodeSetCreate returned NULL here? */
}
if ((seq != NULL) && (seq != outSeq)) {
xmlXPathFreeNodeSet(seq);
}
/*
* Hand over the result. Better to push the set also in
* case of errors.
*/
valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, outSeq));
/*
* Reset the context node.
*/
xpctxt->node = oldContextNode;
#ifdef DEBUG_STEP
xmlGenericError(xmlGenericErrorContext,
"\nExamined %d nodes, found %d nodes at that step\n",
total, nbMatches);
#endif
| 0
|
313,857
|
nv_normal(cmdarg_T *cap)
{
if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G)
{
clearop(cap->oap);
if (restart_edit != 0 && mode_displayed)
clear_cmdline = TRUE; // unshow mode later
restart_edit = 0;
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
cmdwin_result = Ctrl_C;
#endif
if (VIsual_active)
{
end_visual_mode(); // stop Visual
redraw_curbuf_later(INVERTED);
}
// CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set.
if (cap->nchar == Ctrl_G && p_im)
restart_edit = 'a';
}
else
clearopbeep(cap->oap);
}
| 0
|
436,101
|
static inline bool __io_cqring_fill_event(struct io_ring_ctx *ctx, u64 user_data,
long res, unsigned int cflags)
{
struct io_uring_cqe *cqe;
trace_io_uring_complete(ctx, user_data, res, cflags);
/*
* If we can't get a cq entry, userspace overflowed the
* submission (by quite a lot). Increment the overflow count in
* the ring.
*/
cqe = io_get_cqe(ctx);
if (likely(cqe)) {
WRITE_ONCE(cqe->user_data, user_data);
WRITE_ONCE(cqe->res, res);
WRITE_ONCE(cqe->flags, cflags);
return true;
}
return io_cqring_event_overflow(ctx, user_data, res, cflags);
}
| 0
|
197,801
|
bool TensorSliceReader::CopySliceData(const string& name,
const TensorSlice& slice, T* data) const {
std::vector<std::pair<TensorSlice, string>> details;
const TensorSliceSet* tss;
{
mutex_lock l(mu_);
tss = FindTensorSlice(name, slice, &details);
if (!tss && !all_shards_loaded_) {
VLOG(1) << "Did not find slice in preferred shard, loading all shards."
<< name << ": " << slice.DebugString();
LoadAllShards();
tss = FindTensorSlice(name, slice, &details);
}
if (!tss) {
// No such tensor
return false;
}
}
// We have the data -- copy it over.
string value;
for (const auto& x : details) {
const TensorSlice& slice_s = x.first;
const string& fname = x.second;
int idx = gtl::FindWithDefault(fname_to_index_, fname, -1);
CHECK_GE(idx, 0) << "Failed to find the index for filename " << fname;
// We read a record in the corresponding sstable
const string key = EncodeTensorNameSlice(name, slice_s);
if (!sss_[idx]->Get(key, &value)) {
VLOG(1) << "Failed to seek to the record for tensor " << name
<< ", slice " << slice_s.DebugString()
<< ": computed key = " << key;
return false;
}
SavedTensorSlices sts;
if (!ParseProtoUnlimited(&sts, value)) {
VLOG(1) << "Failed to parse the record for tensor " << name << ", slice "
<< slice_s.DebugString() << ": computed key = " << key;
return false;
}
CopyDataFromTensorSliceToTensorSlice(
tss->shape(), slice_s, slice,
checkpoint::TensorProtoData<T>(sts.data().data()), data);
}
return true;
}
| 1
|
226,298
|
GF_Err leva_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i;
GF_LevelAssignmentBox *ptr = (GF_LevelAssignmentBox*)s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u8(bs, ptr->level_count);
for (i = 0; i<ptr->level_count; i++) {
gf_bs_write_u32(bs, ptr->levels[i].track_id);
gf_bs_write_u8(bs, ptr->levels[i].padding_flag << 7 | (ptr->levels[i].type & 0x7F));
if (ptr->levels[i].type == 0) {
gf_bs_write_u32(bs, ptr->levels[i].grouping_type);
}
else if (ptr->levels[i].type == 1) {
gf_bs_write_u32(bs, ptr->levels[i].grouping_type);
gf_bs_write_u32(bs, ptr->levels[i].grouping_type_parameter);
}
else if (ptr->levels[i].type == 4) {
gf_bs_write_u32(bs, ptr->levels[i].sub_track_id);
}
}
return GF_OK;
| 0
|
208,411
|
check_termcode(
int max_offset,
char_u *buf,
int bufsize,
int *buflen)
{
char_u *tp;
char_u *p;
int slen = 0; // init for GCC
int modslen;
int len;
int retval = 0;
int offset;
char_u key_name[2];
int modifiers;
char_u *modifiers_start = NULL;
int key;
int new_slen; // Length of what will replace the termcode
char_u string[MAX_KEY_CODE_LEN + 1];
int i, j;
int idx = 0;
int cpo_koffset;
cpo_koffset = (vim_strchr(p_cpo, CPO_KOFFSET) != NULL);
/*
* Speed up the checks for terminal codes by gathering all first bytes
* used in termleader[]. Often this is just a single <Esc>.
*/
if (need_gather)
gather_termleader();
/*
* Check at several positions in typebuf.tb_buf[], to catch something like
* "x<Up>" that can be mapped. Stop at max_offset, because characters
* after that cannot be used for mapping, and with @r commands
* typebuf.tb_buf[] can become very long.
* This is used often, KEEP IT FAST!
*/
for (offset = 0; offset < max_offset; ++offset)
{
if (buf == NULL)
{
if (offset >= typebuf.tb_len)
break;
tp = typebuf.tb_buf + typebuf.tb_off + offset;
len = typebuf.tb_len - offset; // length of the input
}
else
{
if (offset >= *buflen)
break;
tp = buf + offset;
len = *buflen - offset;
}
/*
* Don't check characters after K_SPECIAL, those are already
* translated terminal chars (avoid translating ~@^Hx).
*/
if (*tp == K_SPECIAL)
{
offset += 2; // there are always 2 extra characters
continue;
}
/*
* Skip this position if the character does not appear as the first
* character in term_strings. This speeds up a lot, since most
* termcodes start with the same character (ESC or CSI).
*/
i = *tp;
for (p = termleader; *p && *p != i; ++p)
;
if (*p == NUL)
continue;
/*
* Skip this position if p_ek is not set and tp[0] is an ESC and we
* are in Insert mode.
*/
if (*tp == ESC && !p_ek && (State & MODE_INSERT))
continue;
key_name[0] = NUL; // no key name found yet
key_name[1] = NUL; // no key name found yet
modifiers = 0; // no modifiers yet
#ifdef FEAT_GUI
if (gui.in_use)
{
/*
* GUI special key codes are all of the form [CSI xx].
*/
if (*tp == CSI) // Special key from GUI
{
if (len < 3)
return -1; // Shouldn't happen
slen = 3;
key_name[0] = tp[1];
key_name[1] = tp[2];
}
}
else
#endif // FEAT_GUI
{
int mouse_index_found = -1;
for (idx = 0; idx < tc_len; ++idx)
{
/*
* Ignore the entry if we are not at the start of
* typebuf.tb_buf[]
* and there are not enough characters to make a match.
* But only when the 'K' flag is in 'cpoptions'.
*/
slen = termcodes[idx].len;
modifiers_start = NULL;
if (cpo_koffset && offset && len < slen)
continue;
if (STRNCMP(termcodes[idx].code, tp,
(size_t)(slen > len ? len : slen)) == 0)
{
int looks_like_mouse_start = FALSE;
if (len < slen) // got a partial sequence
return -1; // need to get more chars
/*
* When found a keypad key, check if there is another key
* that matches and use that one. This makes <Home> to be
* found instead of <kHome> when they produce the same
* key code.
*/
if (termcodes[idx].name[0] == 'K'
&& VIM_ISDIGIT(termcodes[idx].name[1]))
{
for (j = idx + 1; j < tc_len; ++j)
if (termcodes[j].len == slen &&
STRNCMP(termcodes[idx].code,
termcodes[j].code, slen) == 0)
{
idx = j;
break;
}
}
if (slen == 2 && len > 2
&& termcodes[idx].code[0] == ESC
&& termcodes[idx].code[1] == '[')
{
// The mouse termcode "ESC [" is also the prefix of
// "ESC [ I" (focus gained) and other keys. Check some
// more bytes to find out.
if (!isdigit(tp[2]))
{
// ESC [ without number following: Only use it when
// there is no other match.
looks_like_mouse_start = TRUE;
}
else if (termcodes[idx].name[0] == KS_DEC_MOUSE)
{
char_u *nr = tp + 2;
int count = 0;
// If a digit is following it could be a key with
// modifier, e.g., ESC [ 1;2P. Can be confused
// with DEC_MOUSE, which requires four numbers
// following. If not then it can't be a DEC_MOUSE
// code.
for (;;)
{
++count;
(void)getdigits(&nr);
if (nr >= tp + len)
return -1; // partial sequence
if (*nr != ';')
break;
++nr;
if (nr >= tp + len)
return -1; // partial sequence
}
if (count < 4)
continue; // no match
}
}
if (looks_like_mouse_start)
{
// Only use it when there is no other match.
if (mouse_index_found < 0)
mouse_index_found = idx;
}
else
{
key_name[0] = termcodes[idx].name[0];
key_name[1] = termcodes[idx].name[1];
break;
}
}
/*
* Check for code with modifier, like xterm uses:
* <Esc>[123;*X (modslen == slen - 3)
* <Esc>[@;*X (matches <Esc>[X and <Esc>[1;9X )
* Also <Esc>O*X and <M-O>*X (modslen == slen - 2).
* When there is a modifier the * matches a number.
* When there is no modifier the ;* or * is omitted.
*/
if (termcodes[idx].modlen > 0 && mouse_index_found < 0)
{
int at_code;
modslen = termcodes[idx].modlen;
if (cpo_koffset && offset && len < modslen)
continue;
at_code = termcodes[idx].code[modslen] == '@';
if (STRNCMP(termcodes[idx].code, tp,
(size_t)(modslen > len ? len : modslen)) == 0)
{
int n;
if (len <= modslen) // got a partial sequence
return -1; // need to get more chars
if (tp[modslen] == termcodes[idx].code[slen - 1])
// no modifiers
slen = modslen + 1;
else if (tp[modslen] != ';' && modslen == slen - 3)
// no match for "code;*X" with "code;"
continue;
else if (at_code && tp[modslen] != '1')
// no match for "<Esc>[@" with "<Esc>[1"
continue;
else
{
// Skip over the digits, the final char must
// follow. URXVT can use a negative value, thus
// also accept '-'.
for (j = slen - 2; j < len && (isdigit(tp[j])
|| tp[j] == '-' || tp[j] == ';'); ++j)
;
++j;
if (len < j) // got a partial sequence
return -1; // need to get more chars
if (tp[j - 1] != termcodes[idx].code[slen - 1])
continue; // no match
modifiers_start = tp + slen - 2;
// Match! Convert modifier bits.
n = atoi((char *)modifiers_start);
modifiers |= decode_modifiers(n);
slen = j;
}
key_name[0] = termcodes[idx].name[0];
key_name[1] = termcodes[idx].name[1];
break;
}
}
}
if (idx == tc_len && mouse_index_found >= 0)
{
key_name[0] = termcodes[mouse_index_found].name[0];
key_name[1] = termcodes[mouse_index_found].name[1];
}
}
#ifdef FEAT_TERMRESPONSE
if (key_name[0] == NUL
// Mouse codes of DEC and pterm start with <ESC>[. When
// detecting the start of these mouse codes they might as well be
// another key code or terminal response.
# ifdef FEAT_MOUSE_DEC
|| key_name[0] == KS_DEC_MOUSE
# endif
# ifdef FEAT_MOUSE_PTERM
|| key_name[0] == KS_PTERM_MOUSE
# endif
)
{
char_u *argp = tp[0] == ESC ? tp + 2 : tp + 1;
/*
* Check for responses from the terminal starting with {lead}:
* "<Esc>[" or CSI followed by [0-9>?]
*
* - Xterm version string: {lead}>{x};{vers};{y}c
* Also eat other possible responses to t_RV, rxvt returns
* "{lead}?1;2c".
*
* - Cursor position report: {lead}{row};{col}R
* The final byte must be 'R'. It is used for checking the
* ambiguous-width character state.
*
* - window position reply: {lead}3;{x};{y}t
*
* - key with modifiers when modifyOtherKeys is enabled:
* {lead}27;{modifier};{key}~
* {lead}{key};{modifier}u
*/
if (((tp[0] == ESC && len >= 3 && tp[1] == '[')
|| (tp[0] == CSI && len >= 2))
&& (VIM_ISDIGIT(*argp) || *argp == '>' || *argp == '?'))
{
int resp = handle_csi(tp, len, argp, offset, buf,
bufsize, buflen, key_name, &slen);
if (resp != 0)
{
# ifdef DEBUG_TERMRESPONSE
if (resp == -1)
LOG_TR(("Not enough characters for CSI sequence"));
# endif
return resp;
}
}
// Check for fore/background color response from the terminal,
// starting} with <Esc>] or OSC
else if ((*T_RBG != NUL || *T_RFG != NUL)
&& ((tp[0] == ESC && len >= 2 && tp[1] == ']')
|| tp[0] == OSC))
{
if (handle_osc(tp, argp, len, key_name, &slen) == FAIL)
return -1;
}
// Check for key code response from xterm,
// starting with <Esc>P or DCS
else if ((check_for_codes || rcs_status.tr_progress == STATUS_SENT)
&& ((tp[0] == ESC && len >= 2 && tp[1] == 'P')
|| tp[0] == DCS))
{
if (handle_dcs(tp, argp, len, key_name, &slen) == FAIL)
return -1;
}
}
#endif
if (key_name[0] == NUL)
continue; // No match at this position, try next one
// We only get here when we have a complete termcode match
#ifdef FEAT_GUI
/*
* Only in the GUI: Fetch the pointer coordinates of the scroll event
* so that we know which window to scroll later.
*/
if (gui.in_use
&& key_name[0] == (int)KS_EXTRA
&& (key_name[1] == (int)KE_X1MOUSE
|| key_name[1] == (int)KE_X2MOUSE
|| key_name[1] == (int)KE_MOUSEMOVE_XY
|| key_name[1] == (int)KE_MOUSELEFT
|| key_name[1] == (int)KE_MOUSERIGHT
|| key_name[1] == (int)KE_MOUSEDOWN
|| key_name[1] == (int)KE_MOUSEUP))
{
char_u bytes[6];
int num_bytes = get_bytes_from_buf(tp + slen, bytes, 4);
if (num_bytes == -1) // not enough coordinates
return -1;
mouse_col = 128 * (bytes[0] - ' ' - 1) + bytes[1] - ' ' - 1;
mouse_row = 128 * (bytes[2] - ' ' - 1) + bytes[3] - ' ' - 1;
slen += num_bytes;
// equal to K_MOUSEMOVE
if (key_name[1] == (int)KE_MOUSEMOVE_XY)
key_name[1] = (int)KE_MOUSEMOVE;
}
else
#endif
/*
* If it is a mouse click, get the coordinates.
*/
if (key_name[0] == KS_MOUSE
#ifdef FEAT_MOUSE_GPM
|| key_name[0] == KS_GPM_MOUSE
#endif
#ifdef FEAT_MOUSE_JSB
|| key_name[0] == KS_JSBTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_NET
|| key_name[0] == KS_NETTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_DEC
|| key_name[0] == KS_DEC_MOUSE
#endif
#ifdef FEAT_MOUSE_PTERM
|| key_name[0] == KS_PTERM_MOUSE
#endif
#ifdef FEAT_MOUSE_URXVT
|| key_name[0] == KS_URXVT_MOUSE
#endif
|| key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
{
if (check_termcode_mouse(tp, &slen, key_name, modifiers_start, idx,
&modifiers) == -1)
return -1;
}
#ifdef FEAT_GUI
/*
* If using the GUI, then we get menu and scrollbar events.
*
* A menu event is encoded as K_SPECIAL, KS_MENU, KE_FILLER followed by
* four bytes which are to be taken as a pointer to the vimmenu_T
* structure.
*
* A tab line event is encoded as K_SPECIAL KS_TABLINE nr, where "nr"
* is one byte with the tab index.
*
* A scrollbar event is K_SPECIAL, KS_VER_SCROLLBAR, KE_FILLER followed
* by one byte representing the scrollbar number, and then four bytes
* representing a long_u which is the new value of the scrollbar.
*
* A horizontal scrollbar event is K_SPECIAL, KS_HOR_SCROLLBAR,
* KE_FILLER followed by four bytes representing a long_u which is the
* new value of the scrollbar.
*/
# ifdef FEAT_MENU
else if (key_name[0] == (int)KS_MENU)
{
long_u val;
int num_bytes = get_long_from_buf(tp + slen, &val);
if (num_bytes == -1)
return -1;
current_menu = (vimmenu_T *)val;
slen += num_bytes;
// The menu may have been deleted right after it was used, check
// for that.
if (check_menu_pointer(root_menu, current_menu) == FAIL)
{
key_name[0] = KS_EXTRA;
key_name[1] = (int)KE_IGNORE;
}
}
# endif
# ifdef FEAT_GUI_TABLINE
else if (key_name[0] == (int)KS_TABLINE)
{
// Selecting tabline tab or using its menu.
char_u bytes[6];
int num_bytes = get_bytes_from_buf(tp + slen, bytes, 1);
if (num_bytes == -1)
return -1;
current_tab = (int)bytes[0];
if (current_tab == 255) // -1 in a byte gives 255
current_tab = -1;
slen += num_bytes;
}
else if (key_name[0] == (int)KS_TABMENU)
{
// Selecting tabline tab or using its menu.
char_u bytes[6];
int num_bytes = get_bytes_from_buf(tp + slen, bytes, 2);
if (num_bytes == -1)
return -1;
current_tab = (int)bytes[0];
current_tabmenu = (int)bytes[1];
slen += num_bytes;
}
# endif
# ifndef USE_ON_FLY_SCROLL
else if (key_name[0] == (int)KS_VER_SCROLLBAR)
{
long_u val;
char_u bytes[6];
int num_bytes;
// Get the last scrollbar event in the queue of the same type
j = 0;
for (i = 0; tp[j] == CSI && tp[j + 1] == KS_VER_SCROLLBAR
&& tp[j + 2] != NUL; ++i)
{
j += 3;
num_bytes = get_bytes_from_buf(tp + j, bytes, 1);
if (num_bytes == -1)
break;
if (i == 0)
current_scrollbar = (int)bytes[0];
else if (current_scrollbar != (int)bytes[0])
break;
j += num_bytes;
num_bytes = get_long_from_buf(tp + j, &val);
if (num_bytes == -1)
break;
scrollbar_value = val;
j += num_bytes;
slen = j;
}
if (i == 0) // not enough characters to make one
return -1;
}
else if (key_name[0] == (int)KS_HOR_SCROLLBAR)
{
long_u val;
int num_bytes;
// Get the last horiz. scrollbar event in the queue
j = 0;
for (i = 0; tp[j] == CSI && tp[j + 1] == KS_HOR_SCROLLBAR
&& tp[j + 2] != NUL; ++i)
{
j += 3;
num_bytes = get_long_from_buf(tp + j, &val);
if (num_bytes == -1)
break;
scrollbar_value = val;
j += num_bytes;
slen = j;
}
if (i == 0) // not enough characters to make one
return -1;
}
# endif // !USE_ON_FLY_SCROLL
#endif // FEAT_GUI
#if (defined(UNIX) || defined(VMS))
/*
* Handle FocusIn/FocusOut event sequences reported by XTerm.
* (CSI I/CSI O)
*/
if (key_name[0] == KS_EXTRA
# ifdef FEAT_GUI
&& !gui.in_use
# endif
)
{
if (key_name[1] == KE_FOCUSGAINED)
{
if (!focus_state)
{
ui_focus_change(TRUE);
did_cursorhold = TRUE;
focus_state = TRUE;
}
key_name[1] = (int)KE_IGNORE;
}
else if (key_name[1] == KE_FOCUSLOST)
{
if (focus_state)
{
ui_focus_change(FALSE);
did_cursorhold = TRUE;
focus_state = FALSE;
}
key_name[1] = (int)KE_IGNORE;
}
}
#endif
/*
* Change <xHome> to <Home>, <xUp> to <Up>, etc.
*/
key = handle_x_keys(TERMCAP2KEY(key_name[0], key_name[1]));
/*
* Add any modifier codes to our string.
*/
new_slen = modifiers2keycode(modifiers, &key, string);
// Finally, add the special key code to our string
key_name[0] = KEY2TERMCAP0(key);
key_name[1] = KEY2TERMCAP1(key);
if (key_name[0] == KS_KEY)
{
// from ":set <M-b>=xx"
if (has_mbyte)
new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
else
string[new_slen++] = key_name[1];
}
else if (new_slen == 0 && key_name[0] == KS_EXTRA
&& key_name[1] == KE_IGNORE)
{
// Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
// to indicate what happened.
retval = KEYLEN_REMOVED;
}
else
{
string[new_slen++] = K_SPECIAL;
string[new_slen++] = key_name[0];
string[new_slen++] = key_name[1];
}
if (put_string_in_typebuf(offset, slen, string, new_slen,
buf, bufsize, buflen) == FAIL)
return -1;
return retval == 0 ? (len + new_slen - slen + offset) : retval;
}
#ifdef FEAT_TERMRESPONSE
LOG_TR(("normal character"));
#endif
return 0; // no match found
}
| 1
|
276,440
|
explicit BoostedTreesDeserializeEnsembleOp(OpKernelConstruction* context)
: OpKernel(context) {}
| 0
|
254,736
|
njs_data_view_prototype_get(njs_vm_t *vm, njs_value_t *args,
njs_uint_t nargs, njs_index_t type)
{
double v;
uint32_t u32;
uint64_t index;
njs_int_t ret;
njs_bool_t swap;
njs_value_t *this;
const uint8_t *u8;
njs_conv_f32_t conv_f32;
njs_conv_f64_t conv_f64;
njs_data_view_t *view;
njs_array_buffer_t *buffer;
this = njs_argument(args, 0);
if (njs_slow_path(!njs_is_data_view(this))) {
njs_type_error(vm, "this is not a DataView");
return NJS_ERROR;
}
ret = njs_value_to_index(vm, njs_arg(args, nargs, 1), &index);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
swap = njs_bool(njs_arg(args, nargs, 2));
#if NJS_HAVE_LITTLE_ENDIAN
swap = !swap;
#endif
view = njs_data_view(this);
if (njs_slow_path(njs_is_detached_buffer(view->buffer))) {
njs_type_error(vm, "detached buffer");
return NJS_ERROR;
}
if (njs_typed_array_element_size(type) + index > view->byte_length) {
njs_range_error(vm, "index %uL is outside the bound of the buffer",
index);
return NJS_ERROR;
}
buffer = view->buffer;
u8 = &buffer->u.u8[index + view->offset];
switch (type) {
case NJS_OBJ_TYPE_UINT8_ARRAY:
v = *u8;
break;
case NJS_OBJ_TYPE_INT8_ARRAY:
v = (int8_t) *u8;
break;
case NJS_OBJ_TYPE_UINT16_ARRAY:
u32 = njs_get_u16(u8);
if (swap) {
u32 = njs_bswap_u16(u32);
}
v = u32;
break;
case NJS_OBJ_TYPE_INT16_ARRAY:
u32 = njs_get_u16(u8);
if (swap) {
u32 = njs_bswap_u16(u32);
}
v = (int16_t) u32;
break;
case NJS_OBJ_TYPE_UINT32_ARRAY:
case NJS_OBJ_TYPE_INT32_ARRAY:
case NJS_OBJ_TYPE_FLOAT32_ARRAY:
u32 = njs_get_u32(u8);
if (swap) {
u32 = njs_bswap_u32(u32);
}
switch (type) {
case NJS_OBJ_TYPE_UINT32_ARRAY:
v = u32;
break;
case NJS_OBJ_TYPE_INT32_ARRAY:
v = (int32_t) u32;
break;
default:
conv_f32.u = u32;
v = conv_f32.f;
}
break;
default:
/* NJS_OBJ_TYPE_FLOAT64_ARRAY. */
conv_f64.u = njs_get_u64(u8);
if (swap) {
conv_f64.u = njs_bswap_u64(conv_f64.u);
}
v = conv_f64.f;
}
njs_set_number(&vm->retval, v);
return NJS_OK;
}
| 0
|
512,743
|
longlong Item_func_eq::val_int()
{
DBUG_ASSERT(fixed == 1);
int value= cmp.compare();
return value == 0 ? 1 : 0;
}
| 0
|
265,452
|
static int sqfs_search_dir(struct squashfs_dir_stream *dirs, char **token_list,
int token_count, u32 *m_list, int m_count)
{
struct squashfs_super_block *sblk = ctxt.sblk;
char *path, *target, **sym_tokens, *res, *rem;
int j, ret = 0, new_inode_number, offset;
struct squashfs_symlink_inode *sym;
struct squashfs_ldir_inode *ldir;
struct squashfs_dir_inode *dir;
struct fs_dir_stream *dirsp;
struct fs_dirent *dent;
unsigned char *table;
res = NULL;
rem = NULL;
path = NULL;
target = NULL;
sym_tokens = NULL;
dirsp = (struct fs_dir_stream *)dirs;
/* Start by root inode */
table = sqfs_find_inode(dirs->inode_table, le32_to_cpu(sblk->inodes),
sblk->inodes, sblk->block_size);
dir = (struct squashfs_dir_inode *)table;
ldir = (struct squashfs_ldir_inode *)table;
/* get directory offset in directory table */
offset = sqfs_dir_offset(table, m_list, m_count);
dirs->table = &dirs->dir_table[offset];
/* Setup directory header */
dirs->dir_header = malloc(SQFS_DIR_HEADER_SIZE);
if (!dirs->dir_header)
return -ENOMEM;
memcpy(dirs->dir_header, dirs->table, SQFS_DIR_HEADER_SIZE);
/* Initialize squashfs_dir_stream members */
dirs->table += SQFS_DIR_HEADER_SIZE;
dirs->size = get_unaligned_le16(&dir->file_size) - SQFS_DIR_HEADER_SIZE;
dirs->entry_count = dirs->dir_header->count + 1;
/* No path given -> root directory */
if (!strcmp(token_list[0], "/")) {
dirs->table = &dirs->dir_table[offset];
memcpy(&dirs->i_dir, dir, sizeof(*dir));
return 0;
}
for (j = 0; j < token_count; j++) {
if (!sqfs_is_dir(get_unaligned_le16(&dir->inode_type))) {
printf("** Cannot find directory. **\n");
ret = -EINVAL;
goto out;
}
while (!sqfs_readdir(dirsp, &dent)) {
ret = strcmp(dent->name, token_list[j]);
if (!ret)
break;
free(dirs->entry);
dirs->entry = NULL;
}
if (ret) {
printf("** Cannot find directory. **\n");
ret = -EINVAL;
goto out;
}
/* Redefine inode as the found token */
new_inode_number = dirs->entry->inode_offset +
dirs->dir_header->inode_number;
/* Get reference to inode in the inode table */
table = sqfs_find_inode(dirs->inode_table, new_inode_number,
sblk->inodes, sblk->block_size);
dir = (struct squashfs_dir_inode *)table;
/* Check for symbolic link and inode type sanity */
if (get_unaligned_le16(&dir->inode_type) == SQFS_SYMLINK_TYPE) {
sym = (struct squashfs_symlink_inode *)table;
/* Get first j + 1 tokens */
path = sqfs_concat_tokens(token_list, j + 1);
if (!path) {
ret = -ENOMEM;
goto out;
}
/* Resolve for these tokens */
target = sqfs_resolve_symlink(sym, path);
if (!target) {
ret = -ENOMEM;
goto out;
}
/* Join remaining tokens */
rem = sqfs_concat_tokens(token_list + j + 1, token_count -
j - 1);
if (!rem) {
ret = -ENOMEM;
goto out;
}
/* Concatenate remaining tokens and symlink's target */
res = malloc(strlen(rem) + strlen(target) + 1);
if (!res) {
ret = -ENOMEM;
goto out;
}
strcpy(res, target);
res[strlen(target)] = '/';
strcpy(res + strlen(target) + 1, rem);
token_count = sqfs_count_tokens(res);
if (token_count < 0) {
ret = -EINVAL;
goto out;
}
sym_tokens = malloc(token_count * sizeof(char *));
if (!sym_tokens) {
ret = -EINVAL;
goto out;
}
/* Fill tokens list */
ret = sqfs_tokenize(sym_tokens, token_count, res);
if (ret) {
ret = -EINVAL;
goto out;
}
free(dirs->entry);
dirs->entry = NULL;
ret = sqfs_search_dir(dirs, sym_tokens, token_count,
m_list, m_count);
goto out;
} else if (!sqfs_is_dir(get_unaligned_le16(&dir->inode_type))) {
printf("** Cannot find directory. **\n");
free(dirs->entry);
dirs->entry = NULL;
ret = -EINVAL;
goto out;
}
/* Check if it is an extended dir. */
if (get_unaligned_le16(&dir->inode_type) == SQFS_LDIR_TYPE)
ldir = (struct squashfs_ldir_inode *)table;
/* Get dir. offset into the directory table */
offset = sqfs_dir_offset(table, m_list, m_count);
dirs->table = &dirs->dir_table[offset];
/* Copy directory header */
memcpy(dirs->dir_header, &dirs->dir_table[offset],
SQFS_DIR_HEADER_SIZE);
/* Check for empty directory */
if (sqfs_is_empty_dir(table)) {
printf("Empty directory.\n");
free(dirs->entry);
dirs->entry = NULL;
ret = SQFS_EMPTY_DIR;
goto out;
}
dirs->table += SQFS_DIR_HEADER_SIZE;
dirs->size = get_unaligned_le16(&dir->file_size);
dirs->entry_count = dirs->dir_header->count + 1;
dirs->size -= SQFS_DIR_HEADER_SIZE;
free(dirs->entry);
dirs->entry = NULL;
}
offset = sqfs_dir_offset(table, m_list, m_count);
dirs->table = &dirs->dir_table[offset];
if (get_unaligned_le16(&dir->inode_type) == SQFS_DIR_TYPE)
memcpy(&dirs->i_dir, dir, sizeof(*dir));
else
memcpy(&dirs->i_ldir, ldir, sizeof(*ldir));
out:
free(res);
free(rem);
free(path);
free(target);
free(sym_tokens);
return ret;
}
| 0
|
225,089
|
string SummarizeArgs(const protobuf::RepeatedPtrField<OpDef::ArgDef>& args) {
string ret;
for (const OpDef::ArgDef& arg : args) {
if (!ret.empty()) strings::StrAppend(&ret, ", ");
strings::StrAppend(&ret, arg.name(), ":");
if (arg.is_ref()) strings::StrAppend(&ret, "Ref(");
if (!arg.number_attr().empty()) {
strings::StrAppend(&ret, arg.number_attr(), "*");
}
if (arg.type() != DT_INVALID) {
strings::StrAppend(&ret, DataTypeString(arg.type()));
} else {
strings::StrAppend(&ret, arg.type_attr());
}
if (arg.is_ref()) strings::StrAppend(&ret, ")");
}
return ret;
}
| 0
|
219,913
|
GF_Err gf_isom_sdp_add_line(GF_ISOFile *movie, const char *text)
{
GF_UserDataMap *map;
GF_RTPBox *rtp;
GF_Err e;
GF_HintTrackInfoBox *hnti;
char *buf;
if (!movie->moov) return GF_BAD_PARAM;
//check if we have a udta ...
if (!movie->moov->udta) {
e = moov_on_child_box((GF_Box*)movie->moov, gf_isom_box_new_parent(&movie->moov->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE);
if (e) return e;
}
//find a hnti in the udta
map = udta_getEntry(movie->moov->udta, GF_ISOM_BOX_TYPE_HNTI, NULL);
if (!map) {
e = udta_on_child_box((GF_Box *)movie->moov->udta, gf_isom_box_new(GF_ISOM_BOX_TYPE_HNTI), GF_FALSE);
if (e) return e;
map = udta_getEntry(movie->moov->udta, GF_ISOM_BOX_TYPE_HNTI, NULL);
}
//there should be one and only one hnti
if (!gf_list_count(map->boxes) ) {
e = udta_on_child_box((GF_Box *)movie->moov->udta, gf_isom_box_new(GF_ISOM_BOX_TYPE_HNTI), GF_FALSE);
if (e) return e;
}
else if (gf_list_count(map->boxes) < 1) return GF_ISOM_INVALID_FILE;
hnti = (GF_HintTrackInfoBox *)gf_list_get(map->boxes, 0);
if (!hnti->SDP) {
GF_Box *a = gf_isom_box_new_ex(GF_ISOM_BOX_TYPE_RTP, GF_ISOM_BOX_TYPE_HNTI, 0, GF_FALSE);
if (!a) return GF_OUT_OF_MEM;
hnti_on_child_box((GF_Box*)hnti, a, GF_FALSE);
if (!hnti->child_boxes) hnti->child_boxes = gf_list_new();
gf_list_add(hnti->child_boxes, a);
}
rtp = (GF_RTPBox *) hnti->SDP;
if (!rtp->sdpText) {
rtp->sdpText = (char*)gf_malloc(sizeof(char) * (strlen(text) + 3));
if (!rtp->sdpText) return GF_OUT_OF_MEM;
strcpy(rtp->sdpText, text);
strcat(rtp->sdpText, "\r\n");
return GF_OK;
}
buf = (char*)gf_malloc(sizeof(char) * (strlen(rtp->sdpText) + strlen(text) + 3));
if (!buf) return GF_OUT_OF_MEM;
strcpy(buf, rtp->sdpText);
strcat(buf, text);
strcat(buf, "\r\n");
gf_free(rtp->sdpText);
ReorderSDP(buf, GF_TRUE);
rtp->sdpText = buf;
return GF_OK;
}
| 0
|
385,791
|
SYSCALL_DEFINE1(chdir, const char __user *, filename)
{
struct path path;
int error;
unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
retry:
error = user_path_at(AT_FDCWD, filename, lookup_flags, &path);
if (error)
goto out;
error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHDIR);
if (error)
goto dput_and_out;
set_fs_pwd(current->fs, &path);
dput_and_out:
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
out:
return error;
}
| 0
|
513,088
|
bool is_double() const { return m_type == DYN_COL_DOUBLE; }
| 0
|
206,210
|
parse_command_modifiers(
exarg_T *eap,
char **errormsg,
cmdmod_T *cmod,
int skip_only)
{
char_u *cmd_start = NULL;
char_u *p;
int starts_with_colon = FALSE;
int vim9script = in_vim9script();
int has_visual_range = FALSE;
CLEAR_POINTER(cmod);
cmod->cmod_flags = sticky_cmdmod_flags;
if (STRNCMP(eap->cmd, "'<,'>", 5) == 0)
{
// The automatically inserted Visual area range is skipped, so that
// typing ":cmdmod cmd" in Visual mode works without having to move the
// range to after the modififiers.
eap->cmd += 5;
cmd_start = eap->cmd;
has_visual_range = TRUE;
}
// Repeat until no more command modifiers are found.
for (;;)
{
while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':')
{
if (*eap->cmd == ':')
starts_with_colon = TRUE;
++eap->cmd;
}
// in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
&& (getline_equal(eap->getline, eap->cookie, getexmodeline)
|| getline_equal(eap->getline, eap->cookie, getexline))
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
{
eap->cmd = (char_u *)"+";
if (!skip_only)
ex_pressedreturn = TRUE;
}
// ignore comment and empty lines
if (comment_start(eap->cmd, starts_with_colon))
{
// a comment ends at a NL
if (eap->nextcmd == NULL)
{
eap->nextcmd = vim_strchr(eap->cmd, '\n');
if (eap->nextcmd != NULL)
++eap->nextcmd;
}
if (vim9script && has_cmdmod(cmod, FALSE))
*errormsg = _(e_command_modifier_without_command);
return FAIL;
}
if (*eap->cmd == NUL)
{
if (!skip_only)
{
ex_pressedreturn = TRUE;
if (vim9script && has_cmdmod(cmod, FALSE))
*errormsg = _(e_command_modifier_without_command);
}
return FAIL;
}
p = skip_range(eap->cmd, TRUE, NULL);
// In Vim9 script a variable can shadow a command modifier:
// verbose = 123
// verbose += 123
// silent! verbose = func()
// verbose.member = 2
// verbose[expr] = 2
// But not:
// verbose [a, b] = list
if (vim9script)
{
char_u *s, *n;
for (s = eap->cmd; ASCII_ISALPHA(*s); ++s)
;
n = skipwhite(s);
if (*n == '.' || *n == '=' || (*n != NUL && n[1] == '=')
|| *s == '[')
break;
}
switch (*p)
{
// When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd_noparen(&eap->cmd, "aboveleft", 3))
break;
cmod->cmod_split |= WSP_ABOVE;
continue;
case 'b': if (checkforcmd_noparen(&eap->cmd, "belowright", 3))
{
cmod->cmod_split |= WSP_BELOW;
continue;
}
if (checkforcmd_opt(&eap->cmd, "browse", 3, TRUE))
{
#ifdef FEAT_BROWSE_CMD
cmod->cmod_flags |= CMOD_BROWSE;
#endif
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "botright", 2))
break;
cmod->cmod_split |= WSP_BOT;
continue;
case 'c': if (!checkforcmd_opt(&eap->cmd, "confirm", 4, TRUE))
break;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
cmod->cmod_flags |= CMOD_CONFIRM;
#endif
continue;
case 'k': if (checkforcmd_noparen(&eap->cmd, "keepmarks", 3))
{
cmod->cmod_flags |= CMOD_KEEPMARKS;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "keepalt", 5))
{
cmod->cmod_flags |= CMOD_KEEPALT;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "keeppatterns", 5))
{
cmod->cmod_flags |= CMOD_KEEPPATTERNS;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "keepjumps", 5))
break;
cmod->cmod_flags |= CMOD_KEEPJUMPS;
continue;
case 'f': // only accept ":filter {pat} cmd"
{
char_u *reg_pat;
char_u *nulp = NULL;
int c = 0;
if (!checkforcmd_noparen(&p, "filter", 4)
|| *p == NUL
|| (ends_excmd(*p)
#ifdef FEAT_EVAL
// in ":filter #pat# cmd" # does not
// start a comment
&& (!vim9script || VIM_ISWHITE(p[1]))
#endif
))
break;
if (*p == '!')
{
cmod->cmod_filter_force = TRUE;
p = skipwhite(p + 1);
if (*p == NUL || ends_excmd(*p))
break;
}
#ifdef FEAT_EVAL
// Avoid that "filter(arg)" is recognized.
if (vim9script && !VIM_ISWHITE(p[-1]))
break;
#endif
if (skip_only)
p = skip_vimgrep_pat(p, NULL, NULL);
else
// NOTE: This puts a NUL after the pattern.
p = skip_vimgrep_pat_ext(p, ®_pat, NULL,
&nulp, &c);
if (p == NULL || *p == NUL)
break;
if (!skip_only)
{
cmod->cmod_filter_regmatch.regprog =
vim_regcomp(reg_pat, RE_MAGIC);
if (cmod->cmod_filter_regmatch.regprog == NULL)
break;
// restore the character overwritten by NUL
if (nulp != NULL)
*nulp = c;
}
eap->cmd = p;
continue;
}
// ":hide" and ":hide | cmd" are not modifiers
case 'h': if (p != eap->cmd || !checkforcmd_noparen(&p, "hide", 3)
|| *p == NUL || ends_excmd(*p))
break;
eap->cmd = p;
cmod->cmod_flags |= CMOD_HIDE;
continue;
case 'l': if (checkforcmd_noparen(&eap->cmd, "lockmarks", 3))
{
cmod->cmod_flags |= CMOD_LOCKMARKS;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "legacy", 3))
{
if (ends_excmd2(p, eap->cmd))
{
*errormsg =
_(e_legacy_must_be_followed_by_command);
return FAIL;
}
cmod->cmod_flags |= CMOD_LEGACY;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "leftabove", 5))
break;
cmod->cmod_split |= WSP_ABOVE;
continue;
case 'n': if (checkforcmd_noparen(&eap->cmd, "noautocmd", 3))
{
cmod->cmod_flags |= CMOD_NOAUTOCMD;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "noswapfile", 3))
break;
cmod->cmod_flags |= CMOD_NOSWAPFILE;
continue;
case 'r': if (!checkforcmd_noparen(&eap->cmd, "rightbelow", 6))
break;
cmod->cmod_split |= WSP_BELOW;
continue;
case 's': if (checkforcmd_noparen(&eap->cmd, "sandbox", 3))
{
cmod->cmod_flags |= CMOD_SANDBOX;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "silent", 3))
break;
cmod->cmod_flags |= CMOD_SILENT;
if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1]))
{
// ":silent!", but not "silent !cmd"
eap->cmd = skipwhite(eap->cmd + 1);
cmod->cmod_flags |= CMOD_ERRSILENT;
}
continue;
case 't': if (checkforcmd_noparen(&p, "tab", 3))
{
if (!skip_only)
{
long tabnr = get_address(eap, &eap->cmd,
ADDR_TABS, eap->skip,
skip_only, FALSE, 1);
if (tabnr == MAXLNUM)
cmod->cmod_tab = tabpage_index(curtab) + 1;
else
{
if (tabnr < 0 || tabnr > LAST_TAB_NR)
{
*errormsg = _(e_invalid_range);
return FAIL;
}
cmod->cmod_tab = tabnr + 1;
}
}
eap->cmd = p;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "topleft", 2))
break;
cmod->cmod_split |= WSP_TOP;
continue;
case 'u': if (!checkforcmd_noparen(&eap->cmd, "unsilent", 3))
break;
cmod->cmod_flags |= CMOD_UNSILENT;
continue;
case 'v': if (checkforcmd_noparen(&eap->cmd, "vertical", 4))
{
cmod->cmod_split |= WSP_VERT;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "vim9cmd", 4))
{
if (ends_excmd2(p, eap->cmd))
{
*errormsg =
_(e_vim9cmd_must_be_followed_by_command);
return FAIL;
}
cmod->cmod_flags |= CMOD_VIM9CMD;
continue;
}
if (!checkforcmd_noparen(&p, "verbose", 4))
break;
if (vim_isdigit(*eap->cmd))
{
cmod->cmod_verbose = atoi((char *)eap->cmd);
if (cmod->cmod_verbose == 0)
cmod->cmod_verbose = -1;
}
else
cmod->cmod_verbose = 1;
eap->cmd = p;
continue;
}
break;
}
if (has_visual_range)
{
if (eap->cmd > cmd_start)
{
// Move the '<,'> range to after the modifiers and insert a colon.
// Since the modifiers have been parsed put the colon on top of the
// space: "'<,'>mod cmd" -> "mod:'<,'>cmd
// Put eap->cmd after the colon.
mch_memmove(cmd_start - 5, cmd_start, eap->cmd - cmd_start);
eap->cmd -= 5;
mch_memmove(eap->cmd - 1, ":'<,'>", 6);
}
else
// no modifiers, move the pointer back
eap->cmd -= 5;
}
return OK;
}
| 1
|
244,305
|
GF_Err csgp_box_write(GF_Box *s, GF_BitStream *bs)
{
u32 i;
GF_Err e;
GF_CompactSampleGroupBox *ptr = (GF_CompactSampleGroupBox*)s;
u32 pattern_size = get_size_by_code( ((ptr->flags>>4) & 0x3) );
u32 scount_size = get_size_by_code( ((ptr->flags>>2) & 0x3) );
u32 index_size = get_size_by_code( (ptr->flags & 0x3) );
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u8(bs, ptr->version);
gf_bs_write_int(bs, ptr->flags, 24);
gf_bs_write_u32(bs, ptr->grouping_type);
if (ptr->flags & (1<<6))
gf_bs_write_u32(bs, ptr->grouping_type_parameter);
gf_bs_write_u32(bs, ptr->pattern_count);
for (i = 0; i<ptr->pattern_count; i++ ) {
gf_bs_write_int(bs, ptr->patterns[i].length, pattern_size);
gf_bs_write_int(bs, ptr->patterns[i].sample_count, scount_size);
}
for (i = 0; i<ptr->pattern_count; i++ ) {
u32 j;
for (j=0; j<ptr->patterns[i].length; j++) {
u32 idx = ptr->patterns[i].sample_group_description_indices[j];
if (idx > 0x10000) {
idx -= 0x10000;
gf_bs_write_int(bs, 1, 1);
gf_bs_write_int(bs, idx, index_size-1);
} else {
gf_bs_write_int(bs, idx, index_size);
}
}
}
gf_bs_align(bs);
return GF_OK;
}
| 0
|
282,985
|
LJ_NORET LJ_NOINLINE static void err_argmsg(lua_State *L, int narg,
const char *msg)
{
const char *fname = "?";
const char *ftype = lj_debug_funcname(L, L->base - 1, &fname);
if (narg < 0 && narg > LUA_REGISTRYINDEX)
narg = (int)(L->top - L->base) + narg + 1;
if (ftype && ftype[3] == 'h' && --narg == 0) /* Check for "method". */
msg = lj_str_pushf(L, err2msg(LJ_ERR_BADSELF), fname, msg);
else
msg = lj_str_pushf(L, err2msg(LJ_ERR_BADARG), narg, fname, msg);
lj_err_callermsg(L, msg);
}
| 0
|
228,446
|
String WddxPacket::getWddxEncoded(const String& varType,
const String& varValue,
const String& varName,
bool hasVarTag) {
if (varType.compare("NULL") == 0 || varType.compare("null") == 0) {
return wrapValue("<null/>", "", "", varName, hasVarTag);
}
if (varType.compare("boolean") == 0) {
return wrapValue("<boolean value='", "'/>", varValue, varName, hasVarTag);
}
if (varType.compare("integer") == 0 || varType.compare("double") == 0) {
return wrapValue("<number>", "</number>", varValue, varName, hasVarTag);
}
if (varType.compare("string") == 0) {
return wrapValue("<string>", "</string>", varValue, varName, hasVarTag);
}
return "";
}
| 0
|
427,816
|
void __init sev_hardware_setup(void)
{
#ifdef CONFIG_KVM_AMD_SEV
unsigned int eax, ebx, ecx, edx, sev_asid_count, sev_es_asid_count;
bool sev_es_supported = false;
bool sev_supported = false;
if (!sev_enabled || !npt_enabled)
goto out;
/* Does the CPU support SEV? */
if (!boot_cpu_has(X86_FEATURE_SEV))
goto out;
/* Retrieve SEV CPUID information */
cpuid(0x8000001f, &eax, &ebx, &ecx, &edx);
/* Set encryption bit location for SEV-ES guests */
sev_enc_bit = ebx & 0x3f;
/* Maximum number of encrypted guests supported simultaneously */
max_sev_asid = ecx;
if (!max_sev_asid)
goto out;
/* Minimum ASID value that should be used for SEV guest */
min_sev_asid = edx;
sev_me_mask = 1UL << (ebx & 0x3f);
/*
* Initialize SEV ASID bitmaps. Allocate space for ASID 0 in the bitmap,
* even though it's never used, so that the bitmap is indexed by the
* actual ASID.
*/
nr_asids = max_sev_asid + 1;
sev_asid_bitmap = bitmap_zalloc(nr_asids, GFP_KERNEL);
if (!sev_asid_bitmap)
goto out;
sev_reclaim_asid_bitmap = bitmap_zalloc(nr_asids, GFP_KERNEL);
if (!sev_reclaim_asid_bitmap) {
bitmap_free(sev_asid_bitmap);
sev_asid_bitmap = NULL;
goto out;
}
sev_asid_count = max_sev_asid - min_sev_asid + 1;
if (misc_cg_set_capacity(MISC_CG_RES_SEV, sev_asid_count))
goto out;
pr_info("SEV supported: %u ASIDs\n", sev_asid_count);
sev_supported = true;
/* SEV-ES support requested? */
if (!sev_es_enabled)
goto out;
/* Does the CPU support SEV-ES? */
if (!boot_cpu_has(X86_FEATURE_SEV_ES))
goto out;
/* Has the system been allocated ASIDs for SEV-ES? */
if (min_sev_asid == 1)
goto out;
sev_es_asid_count = min_sev_asid - 1;
if (misc_cg_set_capacity(MISC_CG_RES_SEV_ES, sev_es_asid_count))
goto out;
pr_info("SEV-ES supported: %u ASIDs\n", sev_es_asid_count);
sev_es_supported = true;
out:
sev_enabled = sev_supported;
sev_es_enabled = sev_es_supported;
#endif
}
| 0
|
246,729
|
u32 parse_bs_switch(char *arg_val, u32 opt)
{
if (!stricmp(arg_val, "no") || !stricmp(arg_val, "off")) bitstream_switching_mode = GF_DASH_BSMODE_NONE;
else if (!stricmp(arg_val, "merge")) bitstream_switching_mode = GF_DASH_BSMODE_MERGED;
else if (!stricmp(arg_val, "multi")) bitstream_switching_mode = GF_DASH_BSMODE_MULTIPLE_ENTRIES;
else if (!stricmp(arg_val, "single")) bitstream_switching_mode = GF_DASH_BSMODE_SINGLE;
else if (!stricmp(arg_val, "inband")) bitstream_switching_mode = GF_DASH_BSMODE_INBAND;
else {
M4_LOG(GF_LOG_ERROR, ("Unrecognized bitstream switching mode \"%s\" - please check usage\n", arg_val));
return 2;
}
return 0;
}
| 0
|
404,709
|
unsigned long __fdget(unsigned int fd)
{
return __fget_light(fd, FMODE_PATH);
}
| 0
|
353,224
|
SplashFunctionPattern::~SplashFunctionPattern() {
}
| 0
|
512,983
|
Item_bool_rowready_func2* Eq_creator::create_swap(THD *thd, Item *a, Item *b) const
{
return new(thd->mem_root) Item_func_eq(thd, b, a);
}
| 0
|
273,090
|
keyval_get(struct keyval *kv, const char *name)
{
struct onekeyval *okv;
if (!kv)
return NULL;
for (okv = kv->head; okv; okv = okv->next)
{
if (strcasecmp(okv->name, name) == 0)
return okv->value;
}
return NULL;
}
| 0
|
101,661
|
bool WebProcessProxy::checkURLReceivedFromWebProcess(const KURL& url)
{
if (!url.isLocalFile())
return true;
if (m_mayHaveUniversalFileReadSandboxExtension)
return true;
String path = url.fileSystemPath();
for (HashSet<String>::const_iterator iter = m_localPathsWithAssumedReadAccess.begin(); iter != m_localPathsWithAssumedReadAccess.end(); ++iter) {
if (path.startsWith(*iter))
return true;
}
for (WebBackForwardListItemMap::iterator iter = m_backForwardListItemMap.begin(), end = m_backForwardListItemMap.end(); iter != end; ++iter) {
if (KURL(KURL(), iter->value->url()).fileSystemPath() == path)
return true;
if (KURL(KURL(), iter->value->originalURL()).fileSystemPath() == path)
return true;
}
WTFLogAlways("Received an unexpected URL from the web process: '%s'\n", url.string().utf8().data());
return false;
}
| 0
|
349,246
|
int read_super_3(char *source, squashfs_operations **s_ops, void *s)
{
squashfs_super_block_3 *sBlk_3 = s;
/*
* Try to read a squashfs 3 superblock (compatible with 1 and 2 filesystems)
*/
int res = read_fs_bytes(fd, SQUASHFS_START, sizeof(*sBlk_3), sBlk_3);
if(res == FALSE)
return res;
/*
* Check it is a SQUASHFS superblock
*/
swap = 0;
if(sBlk_3->s_magic == SQUASHFS_MAGIC_SWAP) {
squashfs_super_block_3 sblk;
ERROR("Reading a different endian SQUASHFS filesystem on %s\n", source);
SQUASHFS_SWAP_SUPER_BLOCK_3(&sblk, sBlk_3);
memcpy(sBlk_3, &sblk, sizeof(squashfs_super_block_3));
swap = 1;
}
if(sBlk_3->s_magic != SQUASHFS_MAGIC || sBlk_3->s_major != 3 ||
sBlk_3->s_minor > 1)
return -1;
sBlk.s.s_magic = sBlk_3->s_magic;
sBlk.s.inodes = sBlk_3->inodes;
sBlk.s.mkfs_time = sBlk_3->mkfs_time;
sBlk.s.block_size = sBlk_3->block_size;
sBlk.s.fragments = sBlk_3->fragments;
sBlk.s.block_log = sBlk_3->block_log;
sBlk.s.flags = sBlk_3->flags;
sBlk.s.s_major = sBlk_3->s_major;
sBlk.s.s_minor = sBlk_3->s_minor;
sBlk.s.root_inode = sBlk_3->root_inode;
sBlk.s.bytes_used = sBlk_3->bytes_used;
sBlk.s.inode_table_start = sBlk_3->inode_table_start;
sBlk.s.directory_table_start = sBlk_3->directory_table_start;
sBlk.s.fragment_table_start = sBlk_3->fragment_table_start;
sBlk.s.lookup_table_start = sBlk_3->lookup_table_start;
sBlk.no_uids = sBlk_3->no_uids;
sBlk.no_guids = sBlk_3->no_guids;
sBlk.uid_start = sBlk_3->uid_start;
sBlk.guid_start = sBlk_3->guid_start;
sBlk.s.xattr_id_table_start = SQUASHFS_INVALID_BLK;
*s_ops = &ops;
/*
* 3.x filesystems use gzip compression.
*/
comp = lookup_compressor("gzip");
return TRUE;
}
| 0
|
473,825
|
gbk_is_mbc_ambiguous(OnigCaseFoldType flag,
const UChar** pp, const UChar* end, OnigEncoding enc)
{
return onigenc_mbn_is_mbc_ambiguous(enc, flag, pp, end);
}
| 0
|
310,034
|
check_pending(NCURSES_SP_DCL0)
/* check for pending input */
{
bool have_pending = FALSE;
/*
* Only carry out this check when the flag is zero, otherwise we'll
* have the refreshing slow down drastically (or stop) if there's an
* unread character available.
*/
if (SP_PARM->_fifohold != 0)
return FALSE;
if (SP_PARM->_checkfd >= 0) {
#if USE_FUNC_POLL
struct pollfd fds[1];
fds[0].fd = SP_PARM->_checkfd;
fds[0].events = POLLIN;
if (poll(fds, (size_t) 1, 0) > 0) {
have_pending = TRUE;
}
#elif defined(__BEOS__)
/*
* BeOS's select() is declared in socket.h, so the configure script does
* not see it. That's just as well, since that function works only for
* sockets. This (using snooze and ioctl) was distilled from Be's patch
* for ncurses which uses a separate thread to simulate select().
*
* FIXME: the return values from the ioctl aren't very clear if we get
* interrupted.
*/
int n = 0;
int howmany = ioctl(0, 'ichr', &n);
if (howmany >= 0 && n > 0) {
have_pending = TRUE;
}
#elif HAVE_SELECT
fd_set fdset;
struct timeval ktimeout;
ktimeout.tv_sec =
ktimeout.tv_usec = 0;
FD_ZERO(&fdset);
FD_SET(SP_PARM->_checkfd, &fdset);
if (select(SP_PARM->_checkfd + 1, &fdset, NULL, NULL, &ktimeout) != 0) {
have_pending = TRUE;
}
#endif
}
if (have_pending) {
SP_PARM->_fifohold = 5;
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG);
}
return FALSE;
}
| 0
|
215,391
|
static sctp_disposition_t sctp_sf_violation_paramlen(
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands) {
static const char err_str[] = "The following parameter had invalid length:";
return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str,
sizeof(err_str));
}
| 1
|
344,765
|
tilde_expand(const char *filename, uid_t uid, char **retp)
{
const char *path, *sep;
char user[128], *ret;
struct passwd *pw;
u_int len, slash;
if (*filename != '~') {
*retp = xstrdup(filename);
return 0;
}
filename++;
path = strchr(filename, '/');
if (path != NULL && path > filename) { /* ~user/path */
slash = path - filename;
if (slash > sizeof(user) - 1) {
error_f("~username too long");
return -1;
}
memcpy(user, filename, slash);
user[slash] = '\0';
if ((pw = getpwnam(user)) == NULL) {
error_f("No such user %s", user);
return -1;
}
} else if ((pw = getpwuid(uid)) == NULL) { /* ~/path */
error_f("No such uid %ld", (long)uid);
return -1;
}
/* Make sure directory has a trailing '/' */
len = strlen(pw->pw_dir);
if (len == 0 || pw->pw_dir[len - 1] != '/')
sep = "/";
else
sep = "";
/* Skip leading '/' from specified path */
if (path != NULL)
filename = path + 1;
if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= PATH_MAX) {
error_f("Path too long");
return -1;
}
*retp = ret;
return 0;
}
| 0
|
195,069
|
static s32 svc_parse_slice(GF_BitStream *bs, AVCState *avc, AVCSliceInfo *si)
{
s32 pps_id;
/*s->current_picture.reference= h->nal_ref_idc != 0;*/
gf_bs_read_ue_log(bs, "first_mb_in_slice");
si->slice_type = gf_bs_read_ue_log(bs, "slice_type");
if (si->slice_type > 9) return -1;
pps_id = gf_bs_read_ue_log(bs, "pps_id");
if (pps_id > 255)
return -1;
si->pps = &avc->pps[pps_id];
si->pps->id = pps_id;
if (!si->pps->slice_group_count)
return -2;
si->sps = &avc->sps[si->pps->sps_id + GF_SVC_SSPS_ID_SHIFT];
if (!si->sps->log2_max_frame_num)
return -2;
si->frame_num = gf_bs_read_int_log(bs, si->sps->log2_max_frame_num, "frame_num");
si->field_pic_flag = 0;
if (si->sps->frame_mbs_only_flag) {
/*s->picture_structure= PICT_FRAME;*/
}
else {
si->field_pic_flag = gf_bs_read_int_log(bs, 1, "field_pic_flag");
if (si->field_pic_flag) si->bottom_field_flag = gf_bs_read_int_log(bs, 1, "bottom_field_flag");
}
if (si->nal_unit_type == GF_AVC_NALU_IDR_SLICE || si->NalHeader.idr_pic_flag)
si->idr_pic_id = gf_bs_read_ue_log(bs, "idr_pic_id");
if (si->sps->poc_type == 0) {
si->poc_lsb = gf_bs_read_int_log(bs, si->sps->log2_max_poc_lsb, "poc_lsb");
if (si->pps->pic_order_present && !si->field_pic_flag) {
si->delta_poc_bottom = gf_bs_read_se_log(bs, "delta_poc_bottom");
}
}
else if ((si->sps->poc_type == 1) && !si->sps->delta_pic_order_always_zero_flag) {
si->delta_poc[0] = gf_bs_read_se_log(bs, "delta_poc0");
if ((si->pps->pic_order_present == 1) && !si->field_pic_flag)
si->delta_poc[1] = gf_bs_read_se_log(bs, "delta_poc1");
}
if (si->pps->redundant_pic_cnt_present) {
si->redundant_pic_cnt = gf_bs_read_ue_log(bs, "redundant_pic_cnt");
}
return 0;
}
| 1
|
270,919
|
::tensorflow::Status WriteSplits(
const std::vector<std::vector<SPLITS_TYPE>>& out_splits,
OpKernelContext* context) {
OpOutputList splits_out;
TF_RETURN_IF_ERROR(
context->output_list("output_nested_splits", &splits_out));
for (int i = 0; i < out_splits.size(); ++i) {
Tensor* splits;
SPLITS_TYPE num_splits = out_splits[i].size();
TF_RETURN_IF_ERROR(
splits_out.allocate(i, TensorShape({num_splits}), &splits));
auto splits_flat = splits->flat<SPLITS_TYPE>();
std::copy_n(out_splits[i].data(), out_splits[i].size(),
splits_flat.data());
}
return ::tensorflow::Status::OK();
}
| 0
|
199,778
|
size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len, size_t off) {
const char *p, *pe;
int cs = parser->cs;
assert(off <= len && "offset past end of buffer");
p = buffer+off;
pe = buffer+len;
/* assert(*pe == '\0' && "pointer does not end on NUL"); */
assert((size_t) (pe - p) == len - off && "pointers aren't same distance");
#line 87 "ext/puma_http11/http11_parser.c"
{
if ( p == pe )
goto _test_eof;
switch ( cs )
{
case 1:
switch( (*p) ) {
case 36: goto tr0;
case 95: goto tr0;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto tr0;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto tr0;
} else
goto tr0;
goto st0;
st0:
cs = 0;
goto _out;
tr0:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st2;
st2:
if ( ++p == pe )
goto _test_eof2;
case 2:
#line 118 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st27;
case 95: goto st27;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st27;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st27;
} else
goto st27;
goto st0;
tr2:
#line 50 "ext/puma_http11/http11_parser.rl"
{
parser->request_method(parser, PTR_TO(mark), LEN(mark, p));
}
goto st3;
st3:
if ( ++p == pe )
goto _test_eof3;
case 3:
#line 143 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 42: goto tr4;
case 43: goto tr5;
case 47: goto tr6;
case 58: goto tr7;
}
if ( (*p) < 65 ) {
if ( 45 <= (*p) && (*p) <= 57 )
goto tr5;
} else if ( (*p) > 90 ) {
if ( 97 <= (*p) && (*p) <= 122 )
goto tr5;
} else
goto tr5;
goto st0;
tr4:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st4;
st4:
if ( ++p == pe )
goto _test_eof4;
case 4:
#line 167 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr8;
case 35: goto tr9;
}
goto st0;
tr8:
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr31:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
#line 56 "ext/puma_http11/http11_parser.rl"
{
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr33:
#line 56 "ext/puma_http11/http11_parser.rl"
{
parser->fragment(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr37:
#line 69 "ext/puma_http11/http11_parser.rl"
{
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr41:
#line 60 "ext/puma_http11/http11_parser.rl"
{ MARK(query_start, p); }
#line 61 "ext/puma_http11/http11_parser.rl"
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
tr44:
#line 61 "ext/puma_http11/http11_parser.rl"
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st5;
st5:
if ( ++p == pe )
goto _test_eof5;
case 5:
#line 229 "ext/puma_http11/http11_parser.c"
if ( (*p) == 72 )
goto tr10;
goto st0;
tr10:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st6;
st6:
if ( ++p == pe )
goto _test_eof6;
case 6:
#line 241 "ext/puma_http11/http11_parser.c"
if ( (*p) == 84 )
goto st7;
goto st0;
st7:
if ( ++p == pe )
goto _test_eof7;
case 7:
if ( (*p) == 84 )
goto st8;
goto st0;
st8:
if ( ++p == pe )
goto _test_eof8;
case 8:
if ( (*p) == 80 )
goto st9;
goto st0;
st9:
if ( ++p == pe )
goto _test_eof9;
case 9:
if ( (*p) == 47 )
goto st10;
goto st0;
st10:
if ( ++p == pe )
goto _test_eof10;
case 10:
if ( 48 <= (*p) && (*p) <= 57 )
goto st11;
goto st0;
st11:
if ( ++p == pe )
goto _test_eof11;
case 11:
if ( (*p) == 46 )
goto st12;
if ( 48 <= (*p) && (*p) <= 57 )
goto st11;
goto st0;
st12:
if ( ++p == pe )
goto _test_eof12;
case 12:
if ( 48 <= (*p) && (*p) <= 57 )
goto st13;
goto st0;
st13:
if ( ++p == pe )
goto _test_eof13;
case 13:
if ( (*p) == 13 )
goto tr18;
if ( 48 <= (*p) && (*p) <= 57 )
goto st13;
goto st0;
tr18:
#line 65 "ext/puma_http11/http11_parser.rl"
{
parser->http_version(parser, PTR_TO(mark), LEN(mark, p));
}
goto st14;
tr26:
#line 46 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
#line 47 "ext/puma_http11/http11_parser.rl"
{
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
}
goto st14;
tr29:
#line 47 "ext/puma_http11/http11_parser.rl"
{
parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p));
}
goto st14;
st14:
if ( ++p == pe )
goto _test_eof14;
case 14:
#line 322 "ext/puma_http11/http11_parser.c"
if ( (*p) == 10 )
goto st15;
goto st0;
st15:
if ( ++p == pe )
goto _test_eof15;
case 15:
switch( (*p) ) {
case 13: goto st16;
case 33: goto tr21;
case 124: goto tr21;
case 126: goto tr21;
}
if ( (*p) < 45 ) {
if ( (*p) > 39 ) {
if ( 42 <= (*p) && (*p) <= 43 )
goto tr21;
} else if ( (*p) >= 35 )
goto tr21;
} else if ( (*p) > 46 ) {
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto tr21;
} else if ( (*p) > 90 ) {
if ( 94 <= (*p) && (*p) <= 122 )
goto tr21;
} else
goto tr21;
} else
goto tr21;
goto st0;
st16:
if ( ++p == pe )
goto _test_eof16;
case 16:
if ( (*p) == 10 )
goto tr22;
goto st0;
tr22:
#line 73 "ext/puma_http11/http11_parser.rl"
{
parser->body_start = p - buffer + 1;
parser->header_done(parser, p + 1, pe - p - 1);
{p++; cs = 46; goto _out;}
}
goto st46;
st46:
if ( ++p == pe )
goto _test_eof46;
case 46:
#line 373 "ext/puma_http11/http11_parser.c"
goto st0;
tr21:
#line 40 "ext/puma_http11/http11_parser.rl"
{ MARK(field_start, p); }
#line 41 "ext/puma_http11/http11_parser.rl"
{ snake_upcase_char((char *)p); }
goto st17;
tr23:
#line 41 "ext/puma_http11/http11_parser.rl"
{ snake_upcase_char((char *)p); }
goto st17;
st17:
if ( ++p == pe )
goto _test_eof17;
case 17:
#line 389 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 33: goto tr23;
case 58: goto tr24;
case 124: goto tr23;
case 126: goto tr23;
}
if ( (*p) < 45 ) {
if ( (*p) > 39 ) {
if ( 42 <= (*p) && (*p) <= 43 )
goto tr23;
} else if ( (*p) >= 35 )
goto tr23;
} else if ( (*p) > 46 ) {
if ( (*p) < 65 ) {
if ( 48 <= (*p) && (*p) <= 57 )
goto tr23;
} else if ( (*p) > 90 ) {
if ( 94 <= (*p) && (*p) <= 122 )
goto tr23;
} else
goto tr23;
} else
goto tr23;
goto st0;
tr24:
#line 42 "ext/puma_http11/http11_parser.rl"
{
parser->field_len = LEN(field_start, p);
}
goto st18;
tr27:
#line 46 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st18;
st18:
if ( ++p == pe )
goto _test_eof18;
case 18:
#line 428 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 13: goto tr26;
case 32: goto tr27;
}
goto tr25;
tr25:
#line 46 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st19;
st19:
if ( ++p == pe )
goto _test_eof19;
case 19:
#line 442 "ext/puma_http11/http11_parser.c"
if ( (*p) == 13 )
goto tr29;
goto st19;
tr9:
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
tr38:
#line 69 "ext/puma_http11/http11_parser.rl"
{
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
tr42:
#line 60 "ext/puma_http11/http11_parser.rl"
{ MARK(query_start, p); }
#line 61 "ext/puma_http11/http11_parser.rl"
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
tr45:
#line 61 "ext/puma_http11/http11_parser.rl"
{
parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p));
}
#line 53 "ext/puma_http11/http11_parser.rl"
{
parser->request_uri(parser, PTR_TO(mark), LEN(mark, p));
}
goto st20;
st20:
if ( ++p == pe )
goto _test_eof20;
case 20:
#line 488 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr31;
case 60: goto st0;
case 62: goto st0;
case 127: goto st0;
}
if ( (*p) > 31 ) {
if ( 34 <= (*p) && (*p) <= 35 )
goto st0;
} else if ( (*p) >= 0 )
goto st0;
goto tr30;
tr30:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st21;
st21:
if ( ++p == pe )
goto _test_eof21;
case 21:
#line 509 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr33;
case 60: goto st0;
case 62: goto st0;
case 127: goto st0;
}
if ( (*p) > 31 ) {
if ( 34 <= (*p) && (*p) <= 35 )
goto st0;
} else if ( (*p) >= 0 )
goto st0;
goto st21;
tr5:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st22;
st22:
if ( ++p == pe )
goto _test_eof22;
case 22:
#line 530 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 43: goto st22;
case 58: goto st23;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st22;
} else if ( (*p) > 57 ) {
if ( (*p) > 90 ) {
if ( 97 <= (*p) && (*p) <= 122 )
goto st22;
} else if ( (*p) >= 65 )
goto st22;
} else
goto st22;
goto st0;
tr7:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st23;
st23:
if ( ++p == pe )
goto _test_eof23;
case 23:
#line 555 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr8;
case 34: goto st0;
case 35: goto tr9;
case 60: goto st0;
case 62: goto st0;
case 127: goto st0;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
goto st23;
tr6:
#line 37 "ext/puma_http11/http11_parser.rl"
{ MARK(mark, p); }
goto st24;
st24:
if ( ++p == pe )
goto _test_eof24;
case 24:
#line 575 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr37;
case 34: goto st0;
case 35: goto tr38;
case 60: goto st0;
case 62: goto st0;
case 63: goto tr39;
case 127: goto st0;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
goto st24;
tr39:
#line 69 "ext/puma_http11/http11_parser.rl"
{
parser->request_path(parser, PTR_TO(mark), LEN(mark,p));
}
goto st25;
st25:
if ( ++p == pe )
goto _test_eof25;
case 25:
#line 598 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr41;
case 34: goto st0;
case 35: goto tr42;
case 60: goto st0;
case 62: goto st0;
case 127: goto st0;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
goto tr40;
tr40:
#line 60 "ext/puma_http11/http11_parser.rl"
{ MARK(query_start, p); }
goto st26;
st26:
if ( ++p == pe )
goto _test_eof26;
case 26:
#line 618 "ext/puma_http11/http11_parser.c"
switch( (*p) ) {
case 32: goto tr44;
case 34: goto st0;
case 35: goto tr45;
case 60: goto st0;
case 62: goto st0;
case 127: goto st0;
}
if ( 0 <= (*p) && (*p) <= 31 )
goto st0;
goto st26;
st27:
if ( ++p == pe )
goto _test_eof27;
case 27:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st28;
case 95: goto st28;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st28;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st28;
} else
goto st28;
goto st0;
st28:
if ( ++p == pe )
goto _test_eof28;
case 28:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st29;
case 95: goto st29;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st29;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st29;
} else
goto st29;
goto st0;
st29:
if ( ++p == pe )
goto _test_eof29;
case 29:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st30;
case 95: goto st30;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st30;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st30;
} else
goto st30;
goto st0;
st30:
if ( ++p == pe )
goto _test_eof30;
case 30:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st31;
case 95: goto st31;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st31;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st31;
} else
goto st31;
goto st0;
st31:
if ( ++p == pe )
goto _test_eof31;
case 31:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st32;
case 95: goto st32;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st32;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st32;
} else
goto st32;
goto st0;
st32:
if ( ++p == pe )
goto _test_eof32;
case 32:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st33;
case 95: goto st33;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st33;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st33;
} else
goto st33;
goto st0;
st33:
if ( ++p == pe )
goto _test_eof33;
case 33:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st34;
case 95: goto st34;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st34;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st34;
} else
goto st34;
goto st0;
st34:
if ( ++p == pe )
goto _test_eof34;
case 34:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st35;
case 95: goto st35;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st35;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st35;
} else
goto st35;
goto st0;
st35:
if ( ++p == pe )
goto _test_eof35;
case 35:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st36;
case 95: goto st36;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st36;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st36;
} else
goto st36;
goto st0;
st36:
if ( ++p == pe )
goto _test_eof36;
case 36:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st37;
case 95: goto st37;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st37;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st37;
} else
goto st37;
goto st0;
st37:
if ( ++p == pe )
goto _test_eof37;
case 37:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st38;
case 95: goto st38;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st38;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st38;
} else
goto st38;
goto st0;
st38:
if ( ++p == pe )
goto _test_eof38;
case 38:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st39;
case 95: goto st39;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st39;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st39;
} else
goto st39;
goto st0;
st39:
if ( ++p == pe )
goto _test_eof39;
case 39:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st40;
case 95: goto st40;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st40;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st40;
} else
goto st40;
goto st0;
st40:
if ( ++p == pe )
goto _test_eof40;
case 40:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st41;
case 95: goto st41;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st41;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st41;
} else
goto st41;
goto st0;
st41:
if ( ++p == pe )
goto _test_eof41;
case 41:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st42;
case 95: goto st42;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st42;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st42;
} else
goto st42;
goto st0;
st42:
if ( ++p == pe )
goto _test_eof42;
case 42:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st43;
case 95: goto st43;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st43;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st43;
} else
goto st43;
goto st0;
st43:
if ( ++p == pe )
goto _test_eof43;
case 43:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st44;
case 95: goto st44;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st44;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st44;
} else
goto st44;
goto st0;
st44:
if ( ++p == pe )
goto _test_eof44;
case 44:
switch( (*p) ) {
case 32: goto tr2;
case 36: goto st45;
case 95: goto st45;
}
if ( (*p) < 48 ) {
if ( 45 <= (*p) && (*p) <= 46 )
goto st45;
} else if ( (*p) > 57 ) {
if ( 65 <= (*p) && (*p) <= 90 )
goto st45;
} else
goto st45;
goto st0;
st45:
if ( ++p == pe )
goto _test_eof45;
case 45:
if ( (*p) == 32 )
goto tr2;
goto st0;
}
_test_eof2: cs = 2; goto _test_eof;
_test_eof3: cs = 3; goto _test_eof;
_test_eof4: cs = 4; goto _test_eof;
_test_eof5: cs = 5; goto _test_eof;
_test_eof6: cs = 6; goto _test_eof;
_test_eof7: cs = 7; goto _test_eof;
_test_eof8: cs = 8; goto _test_eof;
_test_eof9: cs = 9; goto _test_eof;
_test_eof10: cs = 10; goto _test_eof;
_test_eof11: cs = 11; goto _test_eof;
_test_eof12: cs = 12; goto _test_eof;
_test_eof13: cs = 13; goto _test_eof;
_test_eof14: cs = 14; goto _test_eof;
_test_eof15: cs = 15; goto _test_eof;
_test_eof16: cs = 16; goto _test_eof;
_test_eof46: cs = 46; goto _test_eof;
_test_eof17: cs = 17; goto _test_eof;
_test_eof18: cs = 18; goto _test_eof;
_test_eof19: cs = 19; goto _test_eof;
_test_eof20: cs = 20; goto _test_eof;
_test_eof21: cs = 21; goto _test_eof;
_test_eof22: cs = 22; goto _test_eof;
_test_eof23: cs = 23; goto _test_eof;
_test_eof24: cs = 24; goto _test_eof;
_test_eof25: cs = 25; goto _test_eof;
_test_eof26: cs = 26; goto _test_eof;
_test_eof27: cs = 27; goto _test_eof;
_test_eof28: cs = 28; goto _test_eof;
_test_eof29: cs = 29; goto _test_eof;
_test_eof30: cs = 30; goto _test_eof;
_test_eof31: cs = 31; goto _test_eof;
_test_eof32: cs = 32; goto _test_eof;
_test_eof33: cs = 33; goto _test_eof;
_test_eof34: cs = 34; goto _test_eof;
_test_eof35: cs = 35; goto _test_eof;
_test_eof36: cs = 36; goto _test_eof;
_test_eof37: cs = 37; goto _test_eof;
_test_eof38: cs = 38; goto _test_eof;
_test_eof39: cs = 39; goto _test_eof;
_test_eof40: cs = 40; goto _test_eof;
_test_eof41: cs = 41; goto _test_eof;
_test_eof42: cs = 42; goto _test_eof;
_test_eof43: cs = 43; goto _test_eof;
_test_eof44: cs = 44; goto _test_eof;
_test_eof45: cs = 45; goto _test_eof;
_test_eof: {}
_out: {}
}
#line 117 "ext/puma_http11/http11_parser.rl"
if (!puma_parser_has_error(parser))
parser->cs = cs;
parser->nread += p - (buffer + off);
assert(p <= pe && "buffer overflow after parsing execute");
assert(parser->nread <= len && "nread longer than length");
assert(parser->body_start <= len && "body starts after buffer end");
assert(parser->mark < len && "mark is after buffer end");
assert(parser->field_len <= len && "field has length longer than whole buffer");
assert(parser->field_start < len && "field starts after buffer end");
return(parser->nread);
}
| 1
|
212,152
|
disable_priv_mode ()
{
int e;
if (setuid (current_user.uid) < 0)
{
e = errno;
sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid);
#if defined (EXIT_ON_SETUID_FAILURE)
if (e == EAGAIN)
exit (e);
#endif
}
if (setgid (current_user.gid) < 0)
sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid);
current_user.euid = current_user.uid;
current_user.egid = current_user.gid;
}
| 1
|
274,686
|
callbacks_show_cross_on_drill_holes (GtkMenuItem *menuitem, gpointer user_data)
{
screenRenderInfo.show_cross_on_drill_holes = GTK_CHECK_MENU_ITEM(menuitem)->active;
render_refresh_rendered_image_on_screen();
}
| 0
|
385,789
|
SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
int, newdfd, const char __user *, newname, int, flags)
{
struct dentry *new_dentry;
struct path old_path, new_path;
int how = 0;
int error;
if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)
return -EINVAL;
/*
* To use null names we require CAP_DAC_READ_SEARCH
* This ensures that not everyone will be able to create
* handlink using the passed filedescriptor.
*/
if (flags & AT_EMPTY_PATH) {
if (!capable(CAP_DAC_READ_SEARCH))
return -ENOENT;
how = LOOKUP_EMPTY;
}
if (flags & AT_SYMLINK_FOLLOW)
how |= LOOKUP_FOLLOW;
retry:
error = user_path_at(olddfd, oldname, how, &old_path);
if (error)
return error;
new_dentry = user_path_create(newdfd, newname, &new_path,
(how & LOOKUP_REVAL));
error = PTR_ERR(new_dentry);
if (IS_ERR(new_dentry))
goto out;
error = -EXDEV;
if (old_path.mnt != new_path.mnt)
goto out_dput;
error = may_linkat(&old_path);
if (unlikely(error))
goto out_dput;
error = security_path_link(old_path.dentry, &new_path, new_dentry);
if (error)
goto out_dput;
error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry);
out_dput:
done_path_create(&new_path, new_dentry);
if (retry_estale(error, how)) {
how |= LOOKUP_REVAL;
goto retry;
}
out:
path_put(&old_path);
return error;
}
| 0
|
328,896
|
R_API char *r_bin_java_get_item_name_from_bin_cp_list(RBinJavaObj *bin, RBinJavaCPTypeObj *obj) {
char *res = NULL;
/*
Given a constant pool object Class, FieldRef, MethodRef, or InterfaceMethodRef
return the actual descriptor string.
@param cp_list: RList of RBinJavaCPTypeObj *
@param obj object to look up the name for
@rvalue char* (user frees) or NULL
*/
if (bin && obj) {
res = r_bin_java_get_item_name_from_cp_item_list (
bin->cp_list, obj, MAX_CPITEMS);
}
return res;
}
| 0
|
432,703
|
static void ipa_device_begin(wmfAPI * API)
{
char
comment[MagickPathExtent],
*url;
wmf_magick_t
*ddata = WMF_MAGICK_GetData(API);
/* Make SVG output happy */
(void) PushDrawingWand(WmfDrawingWand);
DrawSetViewbox(WmfDrawingWand,0,0,ddata->image->columns,ddata->image->rows);
url=GetMagickHomeURL();
(void) FormatLocaleString(comment,MagickPathExtent,
"Created by ImageMagick %s",url);
url=DestroyString(url);
DrawComment(WmfDrawingWand,comment);
/* Scale width and height to image */
DrawScale(WmfDrawingWand, ddata->scale_x, ddata->scale_y);
/* Translate to TL corner of bounding box */
DrawTranslate(WmfDrawingWand, ddata->translate_x, ddata->translate_y);
/* Apply rotation */
DrawRotate(WmfDrawingWand, ddata->rotate);
if (ddata->image_info->texture == NULL)
{
PixelWand
*background_color;
/* Draw rectangle in background color */
background_color=NewPixelWand();
PixelSetPixelColor(background_color,&ddata->image->background_color);
DrawSetFillColor(WmfDrawingWand,background_color);
background_color=DestroyPixelWand(background_color);
DrawRectangle(WmfDrawingWand,
XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y),
XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y));
}
else
{
/* Draw rectangle with texture image the SVG way */
Image
*image;
ImageInfo
*image_info;
ExceptionInfo
*exception;
exception=AcquireExceptionInfo();
image_info = CloneImageInfo((ImageInfo *) 0);
(void) CopyMagickString(image_info->filename,ddata->image_info->texture,
MagickPathExtent);
if ( ddata->image_info->size )
CloneString(&image_info->size,ddata->image_info->size);
image = ReadImage(image_info,exception);
(void) DestroyExceptionInfo(exception);
image_info=DestroyImageInfo(image_info);
if (image)
{
char
pattern_id[MagickPathExtent];
MagickWand
*magick_wand;
(void) CopyMagickString(image->magick,"MIFF",MagickPathExtent);
DrawPushDefs(WmfDrawingWand);
draw_pattern_push(API,ddata->pattern_id,image->columns,image->rows);
magick_wand=NewMagickWandFromImage(image);
(void) DrawComposite(WmfDrawingWand,CopyCompositeOp,0,0,
image->columns,image->rows,magick_wand);
magick_wand=DestroyMagickWand(magick_wand);
(void) DrawPopPattern(WmfDrawingWand);
DrawPopDefs(WmfDrawingWand);
(void) FormatLocaleString(pattern_id,MagickPathExtent,"#brush_%lu",
ddata->pattern_id);
(void) DrawSetFillPatternURL(WmfDrawingWand,pattern_id);
++ddata->pattern_id;
DrawRectangle(WmfDrawingWand,
XC(ddata->bbox.TL.x),YC(ddata->bbox.TL.y),
XC(ddata->bbox.BR.x),YC(ddata->bbox.BR.y));
image=DestroyImageList(image);
}
else
{
LogMagickEvent(CoderEvent,GetMagickModule(),
"reading texture image failed!");
}
}
DrawSetClipRule(WmfDrawingWand,EvenOddRule); /* Default for WMF is ALTERNATE polygon fill mode */
draw_fill_color_string(WmfDrawingWand,"none"); /* Default brush is WHITE_BRUSH */
draw_stroke_color_string(WmfDrawingWand,"none"); /* Default pen is BLACK_PEN */
DrawSetStrokeLineCap(WmfDrawingWand,ButtCap); /* Default linecap is PS_ENDCAP_FLAT */
DrawSetStrokeLineJoin(WmfDrawingWand,MiterJoin); /* Default linejoin is PS_JOIN_MITER */
draw_under_color_string(WmfDrawingWand,"white"); /* Default text box is white */
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.