idx
int64 | func
string | target
int64 |
|---|---|---|
409,485
|
out_trash(void)
{
out_pos = 0;
}
| 0
|
221,144
|
GF_Err gf_odf_hevc_cfg_write(GF_HEVCConfig *cfg, u8 **outData, u32 *outSize)
{
GF_Err e;
GF_BitStream *bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);
*outSize = 0;
*outData = NULL;
e = gf_odf_hevc_cfg_write_bs(cfg, bs);
if (e==GF_OK)
gf_bs_get_content(bs, outData, outSize);
gf_bs_del(bs);
return e;
}
| 0
|
450,347
|
static bool check_solid_tile(VncState *vs, int x, int y, int w, int h,
uint32_t* color, bool samecolor)
{
QEMU_BUILD_BUG_ON(VNC_SERVER_FB_BYTES != 4);
return check_solid_tile32(vs, x, y, w, h, color, samecolor);
}
| 0
|
512,585
|
Item_bool_rowready_func2* Gt_creator::create_swap(THD *thd, Item *a, Item *b) const
{
return new(thd->mem_root) Item_func_lt(thd, b, a);
}
| 0
|
455,348
|
dequote_pathname (pathname)
char *pathname;
{
if (MB_CUR_MAX > 1)
wdequote_pathname (pathname);
else
udequote_pathname (pathname);
}
| 0
|
238,570
|
static int resize_reference_state(struct bpf_func_state *state, size_t n)
{
state->refs = realloc_array(state->refs, state->acquired_refs, n,
sizeof(struct bpf_reference_state));
if (!state->refs)
return -ENOMEM;
state->acquired_refs = n;
return 0;
}
| 0
|
513,277
|
int rr_sequential_and_unpack(READ_RECORD *info)
{
int error;
if ((error= rr_sequential(info)))
return error;
for (Copy_field *cp= info->copy_field; cp != info->copy_field_end; cp++)
(*cp->do_copy)(cp);
return error;
}
| 0
|
270,402
|
static bool ok_inflater_literal_tree(ok_inflater *inflater) {
bool done = ok_inflater_inflate_huffman_tree(inflater, inflater->literal_huffman,
inflater->code_length_huffman,
inflater->num_literal_codes);
if (done) {
inflater->state = OK_INFLATER_STATE_READING_DYNAMIC_DISTANCE_TREE;
inflater->huffman_code = -1;
inflater->state_count = 0;
return true;
} else {
return false;
}
}
| 0
|
273,898
|
static void handle_LIST(ctrl_t *ctrl, char *arg)
{
list(ctrl, arg, 0);
}
| 0
|
442,800
|
static char *my_get_line(FILE *fp)
{
char buf[4096];
char *nl = NULL;
char *retval = NULL;
do {
if (NULL == fgets(buf, sizeof(buf), fp))
break;
if (NULL == retval)
retval = strdup(buf);
else {
if (NULL == (retval = realloc(retval,
strlen(retval) + strlen(buf) + 1)))
break;
strcat(retval, buf);
}
}
while (NULL == (nl = strchr(retval, '\n')));
if (NULL != nl)
*nl = '\0';
return retval;
}
| 0
|
212,339
|
static size_t handle_returned_header (void *ptr, size_t size, size_t nmemb, void *stream)
{
auth_client *auth_user = stream;
size_t bytes = size * nmemb;
client_t *client = auth_user->client;
if (client)
{
auth_t *auth = client->auth;
auth_url *url = auth->state;
if (strncasecmp (ptr, url->auth_header, url->auth_header_len) == 0)
client->authenticated = 1;
if (strncasecmp (ptr, url->timelimit_header, url->timelimit_header_len) == 0)
{
unsigned int limit = 0;
sscanf ((char *)ptr+url->timelimit_header_len, "%u\r\n", &limit);
client->con->discon_time = time(NULL) + limit;
}
if (strncasecmp (ptr, "icecast-auth-message: ", 22) == 0)
{
char *eol;
snprintf (url->errormsg, sizeof (url->errormsg), "%s", (char*)ptr+22);
eol = strchr (url->errormsg, '\r');
if (eol == NULL)
eol = strchr (url->errormsg, '\n');
if (eol)
*eol = '\0';
}
}
return bytes;
}
| 1
|
261,901
|
njs_decode_base64(njs_str_t *dst, const njs_str_t *src)
{
njs_decode_base64_core(dst, src, njs_basis64);
}
| 0
|
317,353
|
static int smack_msg_queue_associate(struct kern_ipc_perm *isp, int msqflg)
{
int may;
may = smack_flags_to_may(msqflg);
return smk_curacc_msq(isp, may);
}
| 0
|
253,566
|
static long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode,
loff_t off, loff_t len)
{
/* KEEP_SIZE already checked for by do_fallocate */
if (mode & FALLOC_FL_PUNCH_HOLE)
return smb3_punch_hole(file, tcon, off, len);
else if (mode & FALLOC_FL_ZERO_RANGE) {
if (mode & FALLOC_FL_KEEP_SIZE)
return smb3_zero_range(file, tcon, off, len, true);
return smb3_zero_range(file, tcon, off, len, false);
} else if (mode == FALLOC_FL_KEEP_SIZE)
return smb3_simple_falloc(file, tcon, off, len, true);
else if (mode == FALLOC_FL_COLLAPSE_RANGE)
return smb3_collapse_range(file, tcon, off, len);
else if (mode == FALLOC_FL_INSERT_RANGE)
return smb3_insert_range(file, tcon, off, len);
else if (mode == 0)
return smb3_simple_falloc(file, tcon, off, len, false);
return -EOPNOTSUPP;
}
| 0
|
463,128
|
EXPORTED int annotate_state_set_mailbox(annotate_state_t *state,
struct mailbox *mailbox)
{
return annotate_state_set_scope(state, NULL, mailbox, 0);
}
| 0
|
317,113
|
static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
{
u32 peer_secid = SECSID_NULL;
u16 family;
struct inode_security_struct *isec;
if (skb && skb->protocol == htons(ETH_P_IP))
family = PF_INET;
else if (skb && skb->protocol == htons(ETH_P_IPV6))
family = PF_INET6;
else if (sock)
family = sock->sk->sk_family;
else
goto out;
if (sock && family == PF_UNIX) {
isec = inode_security_novalidate(SOCK_INODE(sock));
peer_secid = isec->sid;
} else if (skb)
selinux_skb_peerlbl_sid(skb, family, &peer_secid);
out:
*secid = peer_secid;
if (peer_secid == SECSID_NULL)
return -EINVAL;
return 0;
}
| 0
|
309,854
|
expected_params(const char *name)
{
#define DATA(name,count) { { name }, count }
/* *INDENT-OFF* */
static const struct {
const char name[9];
int count;
} table[] = {
DATA( "S0", 1 ), /* 'screen' extension */
DATA( "birep", 2 ),
DATA( "chr", 1 ),
DATA( "colornm", 1 ),
DATA( "cpi", 1 ),
DATA( "csnm", 1 ),
DATA( "csr", 2 ),
DATA( "cub", 1 ),
DATA( "cud", 1 ),
DATA( "cuf", 1 ),
DATA( "cup", 2 ),
DATA( "cuu", 1 ),
DATA( "cvr", 1 ),
DATA( "cwin", 5 ),
DATA( "dch", 1 ),
DATA( "defc", 3 ),
DATA( "dial", 1 ),
DATA( "dispc", 1 ),
DATA( "dl", 1 ),
DATA( "ech", 1 ),
DATA( "getm", 1 ),
DATA( "hpa", 1 ),
DATA( "ich", 1 ),
DATA( "il", 1 ),
DATA( "indn", 1 ),
DATA( "initc", 4 ),
DATA( "initp", 7 ),
DATA( "lpi", 1 ),
DATA( "mc5p", 1 ),
DATA( "mrcup", 2 ),
DATA( "mvpa", 1 ),
DATA( "pfkey", 2 ),
DATA( "pfloc", 2 ),
DATA( "pfx", 2 ),
DATA( "pfxl", 3 ),
DATA( "pln", 2 ),
DATA( "qdial", 1 ),
DATA( "rcsd", 1 ),
DATA( "rep", 2 ),
DATA( "rin", 1 ),
DATA( "sclk", 3 ),
DATA( "scp", 1 ),
DATA( "scs", 1 ),
DATA( "scsd", 2 ),
DATA( "setab", 1 ),
DATA( "setaf", 1 ),
DATA( "setb", 1 ),
DATA( "setcolor", 1 ),
DATA( "setf", 1 ),
DATA( "sgr", 9 ),
DATA( "sgr1", 6 ),
DATA( "slength", 1 ),
DATA( "slines", 1 ),
DATA( "smgbp", 1 ), /* 2 if smgtp is not given */
DATA( "smglp", 1 ),
DATA( "smglr", 2 ),
DATA( "smgrp", 1 ),
DATA( "smgtb", 2 ),
DATA( "smgtp", 1 ),
DATA( "tsl", 1 ),
DATA( "u6", -1 ),
DATA( "vpa", 1 ),
DATA( "wind", 4 ),
DATA( "wingo", 1 ),
};
/* *INDENT-ON* */
#undef DATA
unsigned n;
int result = 0; /* function-keys, etc., use none */
for (n = 0; n < SIZEOF(table); n++) {
if (!strcmp(name, table[n].name)) {
result = table[n].count;
break;
}
}
return result;
}
| 0
|
204,412
|
static void *__bpf_ringbuf_reserve(struct bpf_ringbuf *rb, u64 size)
{
unsigned long cons_pos, prod_pos, new_prod_pos, flags;
u32 len, pg_off;
struct bpf_ringbuf_hdr *hdr;
if (unlikely(size > RINGBUF_MAX_RECORD_SZ))
return NULL;
len = round_up(size + BPF_RINGBUF_HDR_SZ, 8);
cons_pos = smp_load_acquire(&rb->consumer_pos);
if (in_nmi()) {
if (!spin_trylock_irqsave(&rb->spinlock, flags))
return NULL;
} else {
spin_lock_irqsave(&rb->spinlock, flags);
}
prod_pos = rb->producer_pos;
new_prod_pos = prod_pos + len;
/* check for out of ringbuf space by ensuring producer position
* doesn't advance more than (ringbuf_size - 1) ahead
*/
if (new_prod_pos - cons_pos > rb->mask) {
spin_unlock_irqrestore(&rb->spinlock, flags);
return NULL;
}
hdr = (void *)rb->data + (prod_pos & rb->mask);
pg_off = bpf_ringbuf_rec_pg_off(rb, hdr);
hdr->len = size | BPF_RINGBUF_BUSY_BIT;
hdr->pg_off = pg_off;
/* pairs with consumer's smp_load_acquire() */
smp_store_release(&rb->producer_pos, new_prod_pos);
spin_unlock_irqrestore(&rb->spinlock, flags);
return (void *)hdr + BPF_RINGBUF_HDR_SZ;
}
| 1
|
218,802
|
static MagickBooleanType ApplyPSDOpacityMask(Image *image,const Image *mask,
Quantum background,MagickBooleanType revert,ExceptionInfo *exception)
{
Image
*complete_mask;
MagickBooleanType
status;
MagickPixelPacket
color;
ssize_t
y;
if (image->matte == MagickFalse)
return(MagickTrue);
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" applying opacity mask");
complete_mask=CloneImage(image,0,0,MagickTrue,exception);
if (complete_mask == (Image *) NULL)
return(MagickFalse);
complete_mask->matte=MagickTrue;
GetMagickPixelPacket(complete_mask,&color);
color.red=(MagickRealType) background;
(void) SetImageColor(complete_mask,&color);
status=CompositeImage(complete_mask,OverCompositeOp,mask,
mask->page.x-image->page.x,mask->page.y-image->page.y);
if (status == MagickFalse)
{
complete_mask=DestroyImage(complete_mask);
return(status);
}
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(status) \
magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
PixelPacket
*magick_restrict q;
PixelPacket
*p;
ssize_t
x;
if (status == MagickFalse)
continue;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
p=GetAuthenticPixels(complete_mask,0,y,complete_mask->columns,1,exception);
if ((q == (PixelPacket *) NULL) || (p == (PixelPacket *) NULL))
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
MagickRealType
alpha,
intensity;
alpha=(MagickRealType) GetPixelAlpha(q);
intensity=GetPixelIntensity(complete_mask,p);
if (revert == MagickFalse)
SetPixelAlpha(q,ClampToQuantum(intensity*(QuantumScale*alpha)));
else if (intensity > 0)
SetPixelAlpha(q,ClampToQuantum((alpha/intensity)*QuantumRange));
q++;
p++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
status=MagickFalse;
}
complete_mask=DestroyImage(complete_mask);
return(status);
}
| 0
|
256,460
|
void janet_array_setcount(JanetArray *array, int32_t count) {
if (count < 0)
return;
if (count > array->count) {
int32_t i;
janet_array_ensure(array, count, 1);
for (i = array->count; i < count; i++) {
array->data[i] = janet_wrap_nil();
}
}
array->count = count;
}
| 0
|
248,764
|
void Curl_cookie_loadfiles(struct Curl_easy *data)
{
struct curl_slist *list = data->state.cookielist;
if(list) {
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
while(list) {
struct CookieInfo *newcookies = Curl_cookie_init(data,
list->data,
data->cookies,
data->set.cookiesession);
if(!newcookies)
/*
* Failure may be due to OOM or a bad cookie; both are ignored
* but only the first should be
*/
infof(data, "ignoring failed cookie_init for %s", list->data);
else
data->cookies = newcookies;
list = list->next;
}
curl_slist_free_all(data->state.cookielist); /* clean up list */
data->state.cookielist = NULL; /* don't do this again! */
Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
}
}
| 0
|
445,932
|
fr_window_update_current_location (FrWindow *window)
{
const char *current_dir = fr_window_get_current_location (window);
char *path;
GtkTreeIter iter;
if (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT) {
gtk_widget_hide (window->priv->location_bar);
return;
}
gtk_widget_show (window->priv->location_bar);
gtk_entry_set_text (GTK_ENTRY (window->priv->location_entry), window->priv->archive_present? current_dir: "");
set_sensitive (window, "GoBack", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->next != NULL));
set_sensitive (window, "GoForward", window->priv->archive_present && (current_dir != NULL) && (window->priv->history_current != NULL) && (window->priv->history_current->prev != NULL));
set_sensitive (window, "GoUp", window->priv->archive_present && (current_dir != NULL) && (strcmp (current_dir, "/") != 0));
set_sensitive (window, "GoHome", window->priv->archive_present);
gtk_widget_set_sensitive (window->priv->location_entry, window->priv->archive_present);
gtk_widget_set_sensitive (window->priv->location_label, window->priv->archive_present);
gtk_widget_set_sensitive (window->priv->filter_entry, window->priv->archive_present);
fr_window_deactivate_filter (window);
#if 0
fr_window_history_print (window);
#endif
path = _g_path_remove_ending_separator (current_dir);
if (get_tree_iter_from_path (window, path, NULL, &iter)) {
GtkTreeSelection *selection;
GtkTreePath *t_path;
t_path = gtk_tree_model_get_path (GTK_TREE_MODEL (window->priv->tree_store), &iter);
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (window->priv->tree_view), t_path);
gtk_tree_path_free (t_path);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (window->priv->tree_view));
gtk_tree_selection_select_iter (selection, &iter);
}
g_free (path);
}
| 0
|
256,140
|
explicit SparseMatMulOp(OpKernelConstruction* ctx) : OpKernel(ctx) {
OP_REQUIRES_OK(ctx, ctx->GetAttr("transpose_a", &transpose_a_));
OP_REQUIRES_OK(ctx, ctx->GetAttr("transpose_b", &transpose_b_));
OP_REQUIRES_OK(ctx, ctx->GetAttr("a_is_sparse", &a_is_sparse_));
OP_REQUIRES_OK(ctx, ctx->GetAttr("b_is_sparse", &b_is_sparse_));
}
| 0
|
512,880
|
String *val_str(String *to) { return cached_time.to_string(to, decimals); }
| 0
|
242,898
|
Status operator()(OpKernelContext* context,
typename TTypes<Tindex>::ConstVec reverse_index_map,
typename TTypes<T>::ConstVec grad_values,
typename TTypes<T>::Vec d_values,
typename TTypes<T>::Scalar d_default_value) {
const CPUDevice& device = context->eigen_device<CPUDevice>();
const Tindex N = reverse_index_map.dimension(0);
const Tindex N_full = grad_values.dimension(0);
T& d_default_value_scalar = d_default_value();
d_default_value_scalar = T();
Tensor visited_t;
TF_RETURN_IF_ERROR(
context->allocate_temp(DT_BOOL, TensorShape({N_full}), &visited_t));
auto visited = visited_t.vec<bool>();
visited.device(device) = visited.constant(false);
for (int i = 0; i < N; ++i) {
// Locate the index of the output of the forward prop associated
// with this location in the input of the forward prop. Copy
// the gradient into it. Mark it as visited.
int64_t reverse_index = reverse_index_map(i);
if (reverse_index < 0 || reverse_index >= N_full) {
return errors::InvalidArgument(
"Elements in reverse index must be in [0, ", N_full, ") but got ",
reverse_index);
}
d_values(i) = grad_values(reverse_index);
visited(reverse_index) = true;
}
for (int j = 0; j < N_full; ++j) {
// The default value gradient gets the accumulated remainder of
// the backprop values (since the default value was used to fill
// in these slots in the forward calculation).
if (!visited(j)) {
d_default_value_scalar += grad_values(j);
}
}
return Status::OK();
}
| 0
|
289,278
|
static snd_pcm_format_t snd_pcm_oss_format_from(int format)
{
switch (format) {
case AFMT_MU_LAW: return SNDRV_PCM_FORMAT_MU_LAW;
case AFMT_A_LAW: return SNDRV_PCM_FORMAT_A_LAW;
case AFMT_IMA_ADPCM: return SNDRV_PCM_FORMAT_IMA_ADPCM;
case AFMT_U8: return SNDRV_PCM_FORMAT_U8;
case AFMT_S16_LE: return SNDRV_PCM_FORMAT_S16_LE;
case AFMT_S16_BE: return SNDRV_PCM_FORMAT_S16_BE;
case AFMT_S8: return SNDRV_PCM_FORMAT_S8;
case AFMT_U16_LE: return SNDRV_PCM_FORMAT_U16_LE;
case AFMT_U16_BE: return SNDRV_PCM_FORMAT_U16_BE;
case AFMT_MPEG: return SNDRV_PCM_FORMAT_MPEG;
case AFMT_S32_LE: return SNDRV_PCM_FORMAT_S32_LE;
case AFMT_S32_BE: return SNDRV_PCM_FORMAT_S32_BE;
case AFMT_S24_LE: return SNDRV_PCM_FORMAT_S24_LE;
case AFMT_S24_BE: return SNDRV_PCM_FORMAT_S24_BE;
case AFMT_S24_PACKED: return SNDRV_PCM_FORMAT_S24_3LE;
case AFMT_FLOAT: return SNDRV_PCM_FORMAT_FLOAT;
case AFMT_SPDIF_RAW: return SNDRV_PCM_FORMAT_IEC958_SUBFRAME;
default: return SNDRV_PCM_FORMAT_U8;
}
}
| 0
|
476,111
|
function_descriptors(struct usb_function *f,
enum usb_device_speed speed)
{
struct usb_descriptor_header **descriptors;
/*
* NOTE: we try to help gadget drivers which might not be setting
* max_speed appropriately.
*/
switch (speed) {
case USB_SPEED_SUPER_PLUS:
descriptors = f->ssp_descriptors;
if (descriptors)
break;
fallthrough;
case USB_SPEED_SUPER:
descriptors = f->ss_descriptors;
if (descriptors)
break;
fallthrough;
case USB_SPEED_HIGH:
descriptors = f->hs_descriptors;
if (descriptors)
break;
fallthrough;
default:
descriptors = f->fs_descriptors;
}
/*
* if we can't find any descriptors at all, then this gadget deserves to
* Oops with a NULL pointer dereference
*/
return descriptors;
}
| 0
|
430,459
|
int ovs_nla_get_identifier(struct sw_flow_id *sfid, const struct nlattr *ufid,
const struct sw_flow_key *key, bool log)
{
struct sw_flow_key *new_key;
if (ovs_nla_get_ufid(sfid, ufid, log))
return 0;
/* If UFID was not provided, use unmasked key. */
new_key = kmalloc(sizeof(*new_key), GFP_KERNEL);
if (!new_key)
return -ENOMEM;
memcpy(new_key, key, sizeof(*key));
sfid->unmasked_key = new_key;
return 0;
}
| 0
|
223,411
|
static void compile_matchingpath(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, backtrack_common *parent)
{
DEFINE_COMPILER;
backtrack_common *backtrack;
BOOL has_then_trap = FALSE;
then_trap_backtrack *save_then_trap = NULL;
SLJIT_ASSERT(*ccend == OP_END || (*ccend >= OP_ALT && *ccend <= OP_KETRPOS));
if (common->has_then && common->then_offsets[cc - common->start] != 0)
{
SLJIT_ASSERT(*ccend != OP_END && common->control_head_ptr != 0);
has_then_trap = TRUE;
save_then_trap = common->then_trap;
/* Tail item on backtrack. */
compile_then_trap_matchingpath(common, cc, ccend, parent);
}
while (cc < ccend)
{
switch(*cc)
{
case OP_SOD:
case OP_SOM:
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
case OP_EODN:
case OP_EOD:
case OP_DOLL:
case OP_DOLLM:
case OP_CIRC:
case OP_CIRCM:
case OP_REVERSE:
cc = compile_simple_assertion_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
break;
case OP_NOT_DIGIT:
case OP_DIGIT:
case OP_NOT_WHITESPACE:
case OP_WHITESPACE:
case OP_NOT_WORDCHAR:
case OP_WORDCHAR:
case OP_ANY:
case OP_ALLANY:
case OP_ANYBYTE:
case OP_NOTPROP:
case OP_PROP:
case OP_ANYNL:
case OP_NOT_HSPACE:
case OP_HSPACE:
case OP_NOT_VSPACE:
case OP_VSPACE:
case OP_EXTUNI:
case OP_NOT:
case OP_NOTI:
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE);
break;
case OP_SET_SOM:
PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
allocate_stack(common, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
cc++;
break;
case OP_CHAR:
case OP_CHARI:
if (common->mode == PCRE2_JIT_COMPLETE)
cc = compile_charn_matchingpath(common, cc, ccend, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
else
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE);
break;
case OP_STAR:
case OP_MINSTAR:
case OP_PLUS:
case OP_MINPLUS:
case OP_QUERY:
case OP_MINQUERY:
case OP_UPTO:
case OP_MINUPTO:
case OP_EXACT:
case OP_POSSTAR:
case OP_POSPLUS:
case OP_POSQUERY:
case OP_POSUPTO:
case OP_STARI:
case OP_MINSTARI:
case OP_PLUSI:
case OP_MINPLUSI:
case OP_QUERYI:
case OP_MINQUERYI:
case OP_UPTOI:
case OP_MINUPTOI:
case OP_EXACTI:
case OP_POSSTARI:
case OP_POSPLUSI:
case OP_POSQUERYI:
case OP_POSUPTOI:
case OP_NOTSTAR:
case OP_NOTMINSTAR:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
case OP_NOTQUERY:
case OP_NOTMINQUERY:
case OP_NOTUPTO:
case OP_NOTMINUPTO:
case OP_NOTEXACT:
case OP_NOTPOSSTAR:
case OP_NOTPOSPLUS:
case OP_NOTPOSQUERY:
case OP_NOTPOSUPTO:
case OP_NOTSTARI:
case OP_NOTMINSTARI:
case OP_NOTPLUSI:
case OP_NOTMINPLUSI:
case OP_NOTQUERYI:
case OP_NOTMINQUERYI:
case OP_NOTUPTOI:
case OP_NOTMINUPTOI:
case OP_NOTEXACTI:
case OP_NOTPOSSTARI:
case OP_NOTPOSPLUSI:
case OP_NOTPOSQUERYI:
case OP_NOTPOSUPTOI:
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
case OP_TYPEEXACT:
case OP_TYPEPOSSTAR:
case OP_TYPEPOSPLUS:
case OP_TYPEPOSQUERY:
case OP_TYPEPOSUPTO:
cc = compile_iterator_matchingpath(common, cc, parent);
break;
case OP_CLASS:
case OP_NCLASS:
if (cc[1 + (32 / sizeof(PCRE2_UCHAR))] >= OP_CRSTAR && cc[1 + (32 / sizeof(PCRE2_UCHAR))] <= OP_CRPOSRANGE)
cc = compile_iterator_matchingpath(common, cc, parent);
else
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE);
break;
#if defined SUPPORT_UNICODE || PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
case OP_XCLASS:
if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRPOSRANGE)
cc = compile_iterator_matchingpath(common, cc, parent);
else
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE);
break;
#endif
case OP_REF:
case OP_REFI:
if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRPOSRANGE)
cc = compile_ref_iterator_matchingpath(common, cc, parent);
else
{
compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
cc += 1 + IMM2_SIZE;
}
break;
case OP_DNREF:
case OP_DNREFI:
if (cc[1 + 2 * IMM2_SIZE] >= OP_CRSTAR && cc[1 + 2 * IMM2_SIZE] <= OP_CRPOSRANGE)
cc = compile_ref_iterator_matchingpath(common, cc, parent);
else
{
compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
cc += 1 + 2 * IMM2_SIZE;
}
break;
case OP_RECURSE:
cc = compile_recurse_matchingpath(common, cc, parent);
break;
case OP_CALLOUT:
case OP_CALLOUT_STR:
cc = compile_callout_matchingpath(common, cc, parent);
break;
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc);
cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
break;
case OP_BRAMINZERO:
PUSH_BACKTRACK_NOVALUE(sizeof(braminzero_backtrack), cc);
cc = bracketend(cc + 1);
if (*(cc - 1 - LINK_SIZE) != OP_KETRMIN)
{
allocate_stack(common, 1);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
}
else
{
allocate_stack(common, 2);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), STR_PTR, 0);
}
BACKTRACK_AS(braminzero_backtrack)->matchingpath = LABEL();
count_match(common);
break;
case OP_ASSERT_NA:
case OP_ASSERTBACK_NA:
case OP_ONCE:
case OP_SCRIPT_RUN:
case OP_BRA:
case OP_CBRA:
case OP_COND:
case OP_SBRA:
case OP_SCBRA:
case OP_SCOND:
cc = compile_bracket_matchingpath(common, cc, parent);
break;
case OP_BRAZERO:
if (cc[1] > OP_ASSERTBACK_NOT)
cc = compile_bracket_matchingpath(common, cc, parent);
else
{
PUSH_BACKTRACK_NOVALUE(sizeof(assert_backtrack), cc);
cc = compile_assert_matchingpath(common, cc, BACKTRACK_AS(assert_backtrack), FALSE);
}
break;
case OP_BRAPOS:
case OP_CBRAPOS:
case OP_SBRAPOS:
case OP_SCBRAPOS:
case OP_BRAPOSZERO:
cc = compile_bracketpos_matchingpath(common, cc, parent);
break;
case OP_MARK:
PUSH_BACKTRACK_NOVALUE(sizeof(backtrack_common), cc);
SLJIT_ASSERT(common->mark_ptr != 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
allocate_stack(common, common->has_skip_arg ? 5 : 1);
if (HAS_VIRTUAL_REGISTERS)
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
if (common->has_skip_arg)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, type_mark);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), SLJIT_IMM, (sljit_sw)(cc + 2));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(3), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP1, 0);
}
cc += 1 + 2 + cc[1];
break;
case OP_PRUNE:
case OP_PRUNE_ARG:
case OP_SKIP:
case OP_SKIP_ARG:
case OP_THEN:
case OP_THEN_ARG:
case OP_COMMIT:
case OP_COMMIT_ARG:
cc = compile_control_verb_matchingpath(common, cc, parent);
break;
case OP_FAIL:
case OP_ACCEPT:
case OP_ASSERT_ACCEPT:
cc = compile_fail_accept_matchingpath(common, cc, parent);
break;
case OP_CLOSE:
cc = compile_close_matchingpath(common, cc);
break;
case OP_SKIPZERO:
cc = bracketend(cc + 1);
break;
default:
SLJIT_UNREACHABLE();
return;
}
if (cc == NULL)
return;
}
if (has_then_trap)
{
/* Head item on backtrack. */
PUSH_BACKTRACK_NOVALUE(sizeof(then_trap_backtrack), cc);
BACKTRACK_AS(then_trap_backtrack)->common.cc = then_trap_opcode;
BACKTRACK_AS(then_trap_backtrack)->then_trap = common->then_trap;
common->then_trap = save_then_trap;
}
SLJIT_ASSERT(cc == ccend);
}
| 0
|
398,518
|
static const ut8 *parse_die(const ut8 *buf, const ut8 *buf_end, RzBinDwarfDebugInfo *info, RzBinDwarfAbbrevDecl *abbrev,
RzBinDwarfCompUnitHdr *hdr, RzBinDwarfDie *die, const ut8 *debug_str, size_t debug_str_len, bool big_endian) {
size_t i;
const char *comp_dir = NULL;
ut64 line_info_offset = UT64_MAX;
if (abbrev->count) {
for (i = 0; i < abbrev->count - 1; i++) {
memset(&die->attr_values[i], 0, sizeof(die->attr_values[i]));
buf = parse_attr_value(buf, buf_end - buf, &abbrev->defs[i],
&die->attr_values[i], hdr, debug_str, debug_str_len, big_endian);
RzBinDwarfAttrValue *attribute = &die->attr_values[i];
if (attribute->attr_name == DW_AT_comp_dir && (attribute->attr_form == DW_FORM_strp || attribute->attr_form == DW_FORM_string) && attribute->string.content) {
comp_dir = attribute->string.content;
}
if (attribute->attr_name == DW_AT_stmt_list) {
if (attribute->kind == DW_AT_KIND_CONSTANT) {
line_info_offset = attribute->uconstant;
} else if (attribute->kind == DW_AT_KIND_REFERENCE) {
line_info_offset = attribute->reference;
}
}
die->count++;
}
}
// If this is a compilation unit dir attribute, we want to cache it so the line info parsing
// which will need this info can quickly look it up.
if (comp_dir && line_info_offset != UT64_MAX) {
char *name = strdup(comp_dir);
if (name) {
if (!ht_up_insert(info->line_info_offset_comp_dir, line_info_offset, name)) {
free(name);
}
}
}
return buf;
}
| 0
|
317,004
|
static struct smack_known *smk_fetch(const char *name, struct inode *ip,
struct dentry *dp)
{
int rc;
char *buffer;
struct smack_known *skp = NULL;
if (!(ip->i_opflags & IOP_XATTR))
return ERR_PTR(-EOPNOTSUPP);
buffer = kzalloc(SMK_LONGLABEL, GFP_NOFS);
if (buffer == NULL)
return ERR_PTR(-ENOMEM);
rc = __vfs_getxattr(dp, ip, name, buffer, SMK_LONGLABEL);
if (rc < 0)
skp = ERR_PTR(rc);
else if (rc == 0)
skp = NULL;
else
skp = smk_import_entry(buffer, rc);
kfree(buffer);
return skp;
}
| 0
|
219,910
|
GF_Err gf_isom_sdp_get(GF_ISOFile *movie, const char **sdp, u32 *length)
{
GF_UserDataMap *map;
GF_HintTrackInfoBox *hnti;
GF_RTPBox *rtp;
*length = 0;
*sdp = NULL;
if (!movie || !movie->moov) return GF_BAD_PARAM;
//check if we have a udta ...
if (!movie->moov->udta) return GF_OK;
//find a hnti in the udta
map = udta_getEntry(movie->moov->udta, GF_ISOM_BOX_TYPE_HNTI, NULL);
if (!map) return GF_OK;
//there should be one and only one hnti
if (gf_list_count(map->boxes) != 1) return GF_ISOM_INVALID_FILE;
hnti = (GF_HintTrackInfoBox *)gf_list_get(map->boxes, 0);
if (!hnti->SDP) return GF_OK;
rtp = (GF_RTPBox *) hnti->SDP;
*length = (u32) strlen(rtp->sdpText);
*sdp = rtp->sdpText;
return GF_OK;
}
| 0
|
387,793
|
Klass* InstanceKlass::array_klass_impl(bool or_null, int n, TRAPS) {
// Need load-acquire for lock-free read
if (array_klasses_acquire() == NULL) {
if (or_null) return NULL;
ResourceMark rm;
JavaThread *jt = (JavaThread *)THREAD;
{
// Atomic creation of array_klasses
MutexLocker mc(Compile_lock, THREAD); // for vtables
MutexLocker ma(MultiArray_lock, THREAD);
// Check if update has already taken place
if (array_klasses() == NULL) {
Klass* k = ObjArrayKlass::allocate_objArray_klass(class_loader_data(), 1, this, CHECK_NULL);
// use 'release' to pair with lock-free load
release_set_array_klasses(k);
}
}
}
// _this will always be set at this point
ObjArrayKlass* oak = (ObjArrayKlass*)array_klasses();
if (or_null) {
return oak->array_klass_or_null(n);
}
return oak->array_klass(n, THREAD);
}
| 0
|
335,411
|
ex_setfiletype(exarg_T *eap)
{
if (!did_filetype)
{
char_u *arg = eap->arg;
if (STRNCMP(arg, "FALLBACK ", 9) == 0)
arg += 9;
set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
if (arg != eap->arg)
did_filetype = FALSE;
}
}
| 0
|
447,055
|
FileIo::~FileIo()
{
close();
delete p_;
}
| 0
|
381,866
|
static void udf_readahead(struct readahead_control *rac)
{
mpage_readahead(rac, udf_get_block);
}
| 0
|
338,123
|
void WasmBinaryWriter::writeFeaturesSection() {
if (!wasm->hasFeaturesSection || wasm->features.isMVP()) {
return;
}
// TODO(tlively): unify feature names with rest of toolchain and use
// FeatureSet::toString()
auto toString = [](FeatureSet::Feature f) {
switch (f) {
case FeatureSet::Atomics:
return BinaryConsts::UserSections::AtomicsFeature;
case FeatureSet::MutableGlobals:
return BinaryConsts::UserSections::MutableGlobalsFeature;
case FeatureSet::TruncSat:
return BinaryConsts::UserSections::TruncSatFeature;
case FeatureSet::SIMD:
return BinaryConsts::UserSections::SIMD128Feature;
case FeatureSet::BulkMemory:
return BinaryConsts::UserSections::BulkMemoryFeature;
case FeatureSet::SignExt:
return BinaryConsts::UserSections::SignExtFeature;
case FeatureSet::ExceptionHandling:
return BinaryConsts::UserSections::ExceptionHandlingFeature;
case FeatureSet::TailCall:
return BinaryConsts::UserSections::TailCallFeature;
case FeatureSet::ReferenceTypes:
return BinaryConsts::UserSections::ReferenceTypesFeature;
case FeatureSet::Multivalue:
return BinaryConsts::UserSections::MultivalueFeature;
case FeatureSet::GC:
return BinaryConsts::UserSections::GCFeature;
case FeatureSet::Memory64:
return BinaryConsts::UserSections::Memory64Feature;
case FeatureSet::TypedFunctionReferences:
return BinaryConsts::UserSections::TypedFunctionReferencesFeature;
case FeatureSet::RelaxedSIMD:
return BinaryConsts::UserSections::RelaxedSIMDFeature;
default:
WASM_UNREACHABLE("unexpected feature flag");
}
};
std::vector<const char*> features;
wasm->features.iterFeatures(
[&](FeatureSet::Feature f) { features.push_back(toString(f)); });
auto start = startSection(BinaryConsts::User);
writeInlineString(BinaryConsts::UserSections::TargetFeatures);
o << U32LEB(features.size());
for (auto& f : features) {
o << uint8_t(BinaryConsts::FeatureUsed);
writeInlineString(f);
}
finishSection(start);
}
| 0
|
314,483
|
static int FNAME(walk_addr)(struct guest_walker *walker,
struct kvm_vcpu *vcpu, gpa_t addr, u64 access)
{
return FNAME(walk_addr_generic)(walker, vcpu, vcpu->arch.mmu, addr,
access);
}
| 0
|
512,274
|
Longlong_null to_longlong_null()
{
longlong nr= val_int();
/*
C++ does not guarantee the order of parameter evaluation,
so to make sure "null_value" is passed to the constructor
after the val_int() call, val_int() is caled on a separate line.
*/
return Longlong_null(nr, null_value);
}
| 0
|
508,380
|
void promote_select_describe_flag_if_needed(LEX *lex)
{
if (lex->describe)
{
lex->select_lex.options |= SELECT_DESCRIBE;
}
}
| 0
|
220,245
|
bool OutputTensor::operator==(const OutputTensor& other) const {
return node == other.node && index == other.index;
}
| 0
|
458,982
|
http_GetContentLength(const struct http *hp)
{
ssize_t cl;
const char *b;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
if (!http_GetHdr(hp, H_Content_Length, &b))
return (-1);
cl = VNUM_uint(b, NULL, &b);
if (cl < 0)
return (-2);
while (vct_islws(*b))
b++;
if (*b != '\0')
return (-2);
return (cl);
}
| 0
|
219,909
|
GF_Err AdjustHintInfo(GF_HintSampleEntryBox *entry, u32 HintSampleNumber)
{
u32 offset, count, i, size;
GF_Err e;
offset = gf_isom_hint_sample_size(entry->hint_sample) - entry->hint_sample->dataLength;
count = gf_list_count(entry->hint_sample->packetTable);
for (i=0; i<count; i++) {
GF_HintPacket *pck = (GF_HintPacket *)gf_list_get(entry->hint_sample->packetTable, i);
if (offset && entry->hint_sample->dataLength) {
//adjust any offset in this packet
e = gf_isom_hint_pck_offset(pck, offset, HintSampleNumber);
if (e) return e;
}
//adjust the max packet size for this sample entry...
size = gf_isom_hint_pck_length(pck);
if (entry->MaxPacketSize < size) entry->MaxPacketSize = size;
}
return GF_OK;
}
| 0
|
512,575
|
bool Item_cond::walk(Item_processor processor, bool walk_subquery, void *arg)
{
List_iterator_fast<Item> li(list);
Item *item;
while ((item= li++))
if (item->walk(processor, walk_subquery, arg))
return 1;
return Item_func::walk(processor, walk_subquery, arg);
}
| 0
|
352,932
|
numericStringNormalize(
slap_mask_t usage,
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
struct berval *normalized,
void *ctx )
{
/* removal all spaces */
char *p, *q;
assert( !BER_BVISEMPTY( val ) );
normalized->bv_val = slap_sl_malloc( val->bv_len + 1, ctx );
p = val->bv_val;
q = normalized->bv_val;
while ( *p ) {
if ( ASCII_SPACE( *p ) ) {
/* Ignore whitespace */
p++;
} else {
*q++ = *p++;
}
}
/* we should have copied no more than is in val */
assert( (q - normalized->bv_val) <= (p - val->bv_val) );
/* null terminate */
*q = '\0';
normalized->bv_len = q - normalized->bv_val;
if( BER_BVISEMPTY( normalized ) ) {
normalized->bv_val = slap_sl_realloc( normalized->bv_val, 2, ctx );
normalized->bv_val[0] = ' ';
normalized->bv_val[1] = '\0';
normalized->bv_len = 1;
}
return LDAP_SUCCESS;
}
| 0
|
282,982
|
LJ_NOINLINE void lj_err_argv(lua_State *L, int narg, ErrMsg em, ...)
{
const char *msg;
va_list argp;
va_start(argp, em);
msg = lj_str_pushvf(L, err2msg(em), argp);
va_end(argp);
err_argmsg(L, narg, msg);
}
| 0
|
245,162
|
lock_binlog_maybe(MYSQL *connection, int timeout, int retry_count)
{
if (have_backup_locks && !opt_no_lock && !binlog_locked) {
if (have_lock_wait_timeout) {
char query[200];
ut_snprintf(query, sizeof(query),
"SET SESSION lock_wait_timeout=%d",
timeout);
}
for (int i = 0; i <= retry_count; ++i) {
msg_ts("Executing LOCK BINLOG FOR BACKUP...\n");
xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP",
false, false);
uint err = mysql_errno(connection);
if (err == ER_LOCK_WAIT_TIMEOUT) {
os_thread_sleep(1000000);
continue;
}
if (err == 0) {
binlog_locked = true;
}
break;
}
if (!binlog_locked) {
exit(EXIT_FAILURE);
}
return(true);
}
return(false);
}
| 0
|
512,635
|
int Arg_comparator::compare_e_decimal()
{
VDec val1(*a), val2(*b);
if (val1.is_null() || val2.is_null())
return MY_TEST(val1.is_null() && val2.is_null());
val1.round_self_if_needed((*a)->decimals, HALF_UP);
val2.round_self_if_needed((*b)->decimals, HALF_UP);
return MY_TEST(val1.cmp(val2) == 0);
}
| 0
|
448,533
|
void bgp_update_implicit_eors(struct peer *peer)
{
if (!bgp_update_delay_active(peer->bgp))
return; /* BGP update delay has ended */
if (peer->update_delay_over)
return; /* This peer has already been considered */
if (bgp_debug_neighbor_events(peer))
zlog_debug("Peer %s: Checking implicit EORs", peer->host);
if (peer_established(peer)) {
peer->update_delay_over = 1;
peer->bgp->implicit_eors++;
bgp_check_update_delay(peer->bgp);
}
}
| 0
|
261,402
|
static int decode_rqt_root_cbf(thread_context* tctx)
{
logtrace(LogSlice,"# rqt_root_cbf\n");
int bit = decode_CABAC_bit(&tctx->cabac_decoder,
&tctx->ctx_model[CONTEXT_MODEL_RQT_ROOT_CBF]);
logtrace(LogSymbols,"$1 rqt_root_cbf=%d\n",bit);
return bit;
}
| 0
|
500,668
|
static sftp_attributes sftp_parse_attr_4(sftp_session sftp, ssh_buffer buf,
int expectnames) {
sftp_attributes attr;
ssh_string owner = NULL;
ssh_string group = NULL;
uint32_t flags = 0;
int ok = 0;
/* unused member variable */
(void) expectnames;
attr = malloc(sizeof(struct sftp_attributes_struct));
if (attr == NULL) {
ssh_set_error_oom(sftp->session);
return NULL;
}
ZERO_STRUCTP(attr);
/* This isn't really a loop, but it is like a try..catch.. */
do {
if (buffer_get_u32(buf, &flags) != 4) {
break;
}
flags = ntohl(flags);
attr->flags = flags;
if (flags & SSH_FILEXFER_ATTR_SIZE) {
if (buffer_get_u64(buf, &attr->size) != 8) {
break;
}
attr->size = ntohll(attr->size);
}
if (flags & SSH_FILEXFER_ATTR_OWNERGROUP) {
if((owner = buffer_get_ssh_string(buf)) == NULL ||
(attr->owner = ssh_string_to_char(owner)) == NULL) {
break;
}
if ((group = buffer_get_ssh_string(buf)) == NULL ||
(attr->group = ssh_string_to_char(group)) == NULL) {
break;
}
}
if (flags & SSH_FILEXFER_ATTR_PERMISSIONS) {
if (buffer_get_u32(buf, &attr->permissions) != 4) {
break;
}
attr->permissions = ntohl(attr->permissions);
/* FIXME on windows! */
switch (attr->permissions & S_IFMT) {
case S_IFSOCK:
case S_IFBLK:
case S_IFCHR:
case S_IFIFO:
attr->type = SSH_FILEXFER_TYPE_SPECIAL;
break;
case S_IFLNK:
attr->type = SSH_FILEXFER_TYPE_SYMLINK;
break;
case S_IFREG:
attr->type = SSH_FILEXFER_TYPE_REGULAR;
break;
case S_IFDIR:
attr->type = SSH_FILEXFER_TYPE_DIRECTORY;
break;
default:
attr->type = SSH_FILEXFER_TYPE_UNKNOWN;
break;
}
}
if (flags & SSH_FILEXFER_ATTR_ACCESSTIME) {
if (buffer_get_u64(buf, &attr->atime64) != 8) {
break;
}
attr->atime64 = ntohll(attr->atime64);
}
if (flags & SSH_FILEXFER_ATTR_SUBSECOND_TIMES) {
if (buffer_get_u32(buf, &attr->atime_nseconds) != 4) {
break;
}
attr->atime_nseconds = ntohl(attr->atime_nseconds);
}
if (flags & SSH_FILEXFER_ATTR_CREATETIME) {
if (buffer_get_u64(buf, &attr->createtime) != 8) {
break;
}
attr->createtime = ntohll(attr->createtime);
}
if (flags & SSH_FILEXFER_ATTR_SUBSECOND_TIMES) {
if (buffer_get_u32(buf, &attr->createtime_nseconds) != 4) {
break;
}
attr->createtime_nseconds = ntohl(attr->createtime_nseconds);
}
if (flags & SSH_FILEXFER_ATTR_MODIFYTIME) {
if (buffer_get_u64(buf, &attr->mtime64) != 8) {
break;
}
attr->mtime64 = ntohll(attr->mtime64);
}
if (flags & SSH_FILEXFER_ATTR_SUBSECOND_TIMES) {
if (buffer_get_u32(buf, &attr->mtime_nseconds) != 4) {
break;
}
attr->mtime_nseconds = ntohl(attr->mtime_nseconds);
}
if (flags & SSH_FILEXFER_ATTR_ACL) {
if ((attr->acl = buffer_get_ssh_string(buf)) == NULL) {
break;
}
}
if (flags & SSH_FILEXFER_ATTR_EXTENDED) {
if (buffer_get_u32(buf,&attr->extended_count) != 4) {
break;
}
attr->extended_count = ntohl(attr->extended_count);
while(attr->extended_count &&
(attr->extended_type = buffer_get_ssh_string(buf)) &&
(attr->extended_data = buffer_get_ssh_string(buf))){
attr->extended_count--;
}
if (attr->extended_count) {
break;
}
}
ok = 1;
} while (0);
if (ok == 0) {
/* break issued somewhere */
ssh_string_free(owner);
ssh_string_free(group);
ssh_string_free(attr->acl);
ssh_string_free(attr->extended_type);
ssh_string_free(attr->extended_data);
SAFE_FREE(attr->owner);
SAFE_FREE(attr->group);
SAFE_FREE(attr);
ssh_set_error(sftp->session, SSH_FATAL, "Invalid ATTR structure");
return NULL;
}
return attr;
}
| 0
|
270,768
|
static int login_global_init(void)
{
login_fail_command = xstrdup("boot");
globalvar_add_simple_int("login.timeout", &login_timeout, "%d");
globalvar_add_simple_string("login.fail_command", &login_fail_command);
return 0;
}
| 0
|
444,892
|
assemble_mountinfo(struct parsed_mount_info *parsed_info,
const char *thisprogram, const char *mountpoint,
const char *orig_dev, char *orgoptions)
{
int rc;
rc = drop_capabilities(0);
if (rc)
goto assemble_exit;
rc = drop_child_privs();
if (rc)
goto assemble_exit;
if (getuid()) {
rc = check_fstab(thisprogram, mountpoint, orig_dev,
&orgoptions);
if (rc)
goto assemble_exit;
/* enable any default user mount flags */
parsed_info->flags |= CIFS_SETUID_FLAGS;
}
rc = get_pw_from_env(parsed_info);
if (rc)
goto assemble_exit;
if (orgoptions) {
rc = parse_options(orgoptions, parsed_info);
if (rc)
goto assemble_exit;
}
if (getuid()) {
if (!(parsed_info->flags & (MS_USERS | MS_USER))) {
fprintf(stderr, "%s: permission denied\n", thisprogram);
rc = EX_USAGE;
goto assemble_exit;
}
}
parsed_info->flags &= ~(MS_USERS | MS_USER);
rc = parse_unc(orig_dev, parsed_info);
if (rc)
goto assemble_exit;
if (parsed_info->addrlist[0] == '\0')
rc = resolve_host(parsed_info->host, parsed_info->addrlist);
switch (rc) {
case EX_USAGE:
fprintf(stderr, "mount error: could not resolve address for "
"%s: %s\n", parsed_info->host,
rc == EAI_SYSTEM ? strerror(errno) : gai_strerror(rc));
goto assemble_exit;
case EX_SYSERR:
fprintf(stderr, "mount error: problem parsing address "
"list: %s\n", strerror(errno));
goto assemble_exit;
}
if (!parsed_info->got_user) {
/*
* Note that the password will not be retrieved from the
* USER env variable (ie user%password form) as there is
* already a PASSWD environment varaible
*/
if (getenv("USER"))
strlcpy(parsed_info->username, getenv("USER"),
sizeof(parsed_info->username));
else
strlcpy(parsed_info->username, getusername(getuid()),
sizeof(parsed_info->username));
parsed_info->got_user = 1;
}
if (!parsed_info->got_password) {
/* getpass is obsolete, but there's apparently nothing that replaces it */
char *tmp_pass = getpass("Password: ");
if (!tmp_pass) {
fprintf(stderr, "Error reading password, exiting\n");
rc = EX_SYSERR;
goto assemble_exit;
}
rc = set_password(parsed_info, tmp_pass);
if (rc)
goto assemble_exit;
}
/* copy in ver= string. It's not really needed, but what the hell */
strlcat(parsed_info->options, ",ver=", sizeof(parsed_info->options));
strlcat(parsed_info->options, OPTIONS_VERSION, sizeof(parsed_info->options));
/* copy in user= string */
if (parsed_info->got_user) {
strlcat(parsed_info->options, ",user=",
sizeof(parsed_info->options));
strlcat(parsed_info->options, parsed_info->username,
sizeof(parsed_info->options));
}
if (*parsed_info->domain) {
strlcat(parsed_info->options, ",domain=",
sizeof(parsed_info->options));
strlcat(parsed_info->options, parsed_info->domain,
sizeof(parsed_info->options));
}
assemble_exit:
return rc;
}
| 0
|
352,978
|
serialNumberAndIssuerSerialPretty(
Syntax *syntax,
struct berval *in,
struct berval *out,
void *ctx )
{
struct berval sn, i, i_sn, ni = BER_BVNULL;
char *p;
int rc;
assert( in != NULL );
assert( out != NULL );
Debug( LDAP_DEBUG_TRACE, ">>> serialNumberAndIssuerSerialPretty: <%s>\n",
in->bv_val );
rc = serialNumberAndIssuerSerialCheck( in, &sn, &i, &i_sn, ctx );
if ( rc ) {
goto done;
}
rc = dnPretty( syntax, &i, &ni, ctx );
if ( in->bv_val[0] == '{' && in->bv_val[in->bv_len-1] == '}' ) {
slap_sl_free( i.bv_val, ctx );
}
if ( rc ) {
rc = LDAP_INVALID_SYNTAX;
goto done;
}
/* make room from sn + "$" */
out->bv_len = STRLENOF("{ serialNumber , issuer { baseCertificateID { issuer { directoryName:rdnSequence:\"\" }, serial } } }")
+ sn.bv_len + ni.bv_len + i_sn.bv_len;
out->bv_val = slap_sl_malloc( out->bv_len + 1, ctx );
if ( out->bv_val == NULL ) {
out->bv_len = 0;
rc = LDAP_OTHER;
goto done;
}
p = out->bv_val;
p = lutil_strcopy( p, "{ serialNumber " );
p = lutil_strbvcopy( p, &sn );
p = lutil_strcopy( p, ", issuer { baseCertificateID { issuer { directoryName:rdnSequence:\"" );
p = lutil_strbvcopy( p, &ni );
p = lutil_strcopy( p, "\" }, serial " );
p = lutil_strbvcopy( p, &i_sn );
p = lutil_strcopy( p, " } } }" );
assert( p == &out->bv_val[out->bv_len] );
done:;
Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerSerialPretty: <%s> => <%s>\n",
in->bv_val, rc == LDAP_SUCCESS ? out->bv_val : "(err)" );
slap_sl_free( ni.bv_val, ctx );
return rc;
}
| 0
|
225,710
|
GF_Err dac3_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_AC3ConfigBox *ptr = (GF_AC3ConfigBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
return gf_odf_ac3_config_parse_bs(bs, ptr->cfg.is_ec3, &ptr->cfg);
| 0
|
343,122
|
static void esp6_destroy(struct xfrm_state *x)
{
struct crypto_aead *aead = x->data;
if (!aead)
return;
crypto_free_aead(aead);
}
| 0
|
259,292
|
static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVFormatContext *ctx = c->fc;
AVStream *st = NULL;
AVBPrint scheme_buf, value_buf;
int64_t scheme_str_len = 0, value_str_len = 0;
int version, flags, ret = AVERROR_BUG;
int64_t size = atom.size;
if (atom.size < 6)
// 4 bytes for version + flags, 2x 1 byte for null
return AVERROR_INVALIDDATA;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
version = avio_r8(pb);
flags = avio_rb24(pb);
size -= 4;
if (version != 0 || flags != 0) {
av_log(ctx, AV_LOG_ERROR,
"Unsupported 'kind' box with version %d, flags: %x",
version, flags);
return AVERROR_INVALIDDATA;
}
av_bprint_init(&scheme_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
av_bprint_init(&value_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
if ((scheme_str_len = ff_read_string_to_bprint_overwrite(pb, &scheme_buf,
size)) < 0) {
ret = scheme_str_len;
goto cleanup;
}
if (scheme_str_len + 1 >= size) {
// we need to have another string, even if nullptr.
// we check with + 1 since we expect that if size was not hit,
// an additional null was read.
ret = AVERROR_INVALIDDATA;
goto cleanup;
}
size -= scheme_str_len + 1;
if ((value_str_len = ff_read_string_to_bprint_overwrite(pb, &value_buf,
size)) < 0) {
ret = value_str_len;
goto cleanup;
}
if (value_str_len == size) {
// in case of no trailing null, box is not valid.
ret = AVERROR_INVALIDDATA;
goto cleanup;
}
av_log(ctx, AV_LOG_TRACE,
"%s stream %d KindBox(scheme: %s, value: %s)\n",
av_get_media_type_string(st->codecpar->codec_type),
st->index,
scheme_buf.str, value_buf.str);
for (int i = 0; ff_mov_track_kind_table[i].scheme_uri; i++) {
const struct MP4TrackKindMapping map = ff_mov_track_kind_table[i];
if (!av_strstart(scheme_buf.str, map.scheme_uri, NULL))
continue;
for (int j = 0; map.value_maps[j].disposition; j++) {
const struct MP4TrackKindValueMapping value_map = map.value_maps[j];
if (!av_strstart(value_buf.str, value_map.value, NULL))
continue;
st->disposition |= value_map.disposition;
}
}
ret = 0;
cleanup:
av_bprint_finalize(&scheme_buf, NULL);
av_bprint_finalize(&value_buf, NULL);
return ret;
}
| 0
|
291,820
|
int rtrs_clt_request(int dir, struct rtrs_clt_req_ops *ops,
struct rtrs_clt_sess *clt, struct rtrs_permit *permit,
const struct kvec *vec, size_t nr, size_t data_len,
struct scatterlist *sg, unsigned int sg_cnt)
{
struct rtrs_clt_io_req *req;
struct rtrs_clt_path *clt_path;
enum dma_data_direction dma_dir;
int err = -ECONNABORTED, i;
size_t usr_len, hdr_len;
struct path_it it;
/* Get kvec length */
for (i = 0, usr_len = 0; i < nr; i++)
usr_len += vec[i].iov_len;
if (dir == READ) {
hdr_len = sizeof(struct rtrs_msg_rdma_read) +
sg_cnt * sizeof(struct rtrs_sg_desc);
dma_dir = DMA_FROM_DEVICE;
} else {
hdr_len = sizeof(struct rtrs_msg_rdma_write);
dma_dir = DMA_TO_DEVICE;
}
rcu_read_lock();
for (path_it_init(&it, clt);
(clt_path = it.next_path(&it)) && it.i < it.clt->paths_num; it.i++) {
if (READ_ONCE(clt_path->state) != RTRS_CLT_CONNECTED)
continue;
if (usr_len + hdr_len > clt_path->max_hdr_size) {
rtrs_wrn_rl(clt_path->clt,
"%s request failed, user message size is %zu and header length %zu, but max size is %u\n",
dir == READ ? "Read" : "Write",
usr_len, hdr_len, clt_path->max_hdr_size);
err = -EMSGSIZE;
break;
}
req = rtrs_clt_get_req(clt_path, ops->conf_fn, permit, ops->priv,
vec, usr_len, sg, sg_cnt, data_len,
dma_dir);
if (dir == READ)
err = rtrs_clt_read_req(req);
else
err = rtrs_clt_write_req(req);
if (err) {
req->in_use = false;
continue;
}
/* Success path */
break;
}
path_it_deinit(&it);
rcu_read_unlock();
return err;
}
| 0
|
477,813
|
int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp)
{
struct kvm_rtas_token_args args;
int rc;
if (copy_from_user(&args, argp, sizeof(args)))
return -EFAULT;
mutex_lock(&kvm->arch.rtas_token_lock);
if (args.token)
rc = rtas_token_define(kvm, args.name, args.token);
else
rc = rtas_token_undefine(kvm, args.name);
mutex_unlock(&kvm->arch.rtas_token_lock);
return rc;
}
| 0
|
256,165
|
inline void SparseMatMul<TL, TR>::Compute(
typename SparseMatMul<TL, TR>::TensorInfoCache* /*cache*/,
const typename SparseMatMul<TL, TR>::ConstMatrixMapL& left,
const typename SparseMatMul<TL, TR>::ConstMatrixMapR& right,
bool transpose_left, const DeviceBase::CpuWorkerThreads* thread_pool,
bool transpose_output, MatrixMap* output) {
const int num_threads = thread_pool->num_threads;
int KR, NR, KL, JB, IB;
ComputeBlockSizes(left, right, transpose_left, num_threads, &KR, &NR, &KL,
&JB, &IB);
// Slice the left matrix
std::vector<std::vector<SparseSlice<TL>*>> left_slices;
std::unique_ptr<BlockingCounter> sparse_slice_counter =
CreateSparseSlices(ConstMatrixMapL(left.data(), left.dimensions()),
transpose_left, M, K, KL, &left_slices, thread_pool);
const int num_left_slices = left_slices.size();
const int right_dim0 = right.dimension(0);
const int right_dim1 = right.dimension(1);
// Allocate buffer for storing slices of right matrix.
// Note buffer needs enough space to hold at most a KR * NR matrix since that
// is the block size per iteration.
const int buffer_num_rows =
std::min(KR, right_dim0) * ((std::min(NR, right_dim1) + N - 1) / N);
MatrixR buffer(buffer_num_rows, N);
std::vector<ConstMatrixMapR*> right_slices;
std::vector<SparseSlice<TL>*> block_left_slices;
std::vector<std::function<void(void)>> tasks;
// Number of blocks based on block sizes of KR * NR.
const int num_k_blocks = (right_dim0 + KR - 1) / KR;
const int num_n_blocks = (right_dim1 + NR - 1) / NR;
std::unique_ptr<BlockingCounter> dense_slice_counter;
for (int nb = 0; nb < num_n_blocks; ++nb) {
const int right_num_cols =
std::min(NR, static_cast<int>(right_dim1 - NR * nb));
for (int kb = 0; kb < num_k_blocks; ++kb) {
const int right_num_rows =
std::min(KR, static_cast<int>(right_dim0 - KR * kb));
dense_slice_counter = CreateDenseSlices(
right, kb * KR, right_num_rows, nb * NR, right_num_cols, thread_pool,
&buffer, &right_slices);
const int num_right_slices = right_slices.size();
tasks.reserve(num_left_slices * num_right_slices);
for (int j_outer = 0; j_outer < num_right_slices; j_outer += JB) {
for (int i_outer = 0; i_outer < num_left_slices; i_outer += IB) {
for (int j_inner = j_outer;
j_inner < std::min(num_right_slices, j_outer + JB); ++j_inner) {
const int num_cols = std::min(N, right_num_cols - N * j_inner);
for (int i_inner = i_outer;
i_inner < std::min(num_left_slices, i_outer + IB); ++i_inner) {
block_left_slices.clear();
int begin = kb * KR / KL;
int end = std::min<int>((kb + 1) * KR / KL,
(right.dimension(0) + KL - 1) / KL);
DCHECK_LT(begin, end);
block_left_slices.insert(block_left_slices.begin(),
left_slices[i_inner].begin() + begin,
left_slices[i_inner].begin() + end);
tasks.push_back(std::bind(
&ComputeOutputBlock, block_left_slices,
std::ref(*right_slices[j_inner]), num_cols, M * i_inner,
N * j_inner + nb * NR, kb == 0, transpose_output, output));
}
}
}
}
if (sparse_slice_counter) {
sparse_slice_counter->Wait();
sparse_slice_counter.reset(nullptr);
}
if (dense_slice_counter) {
dense_slice_counter->Wait();
dense_slice_counter.reset(nullptr);
}
BlockingCounter bc(tasks.size());
for (const auto& t : tasks) {
thread_pool->workers->Schedule([&bc, &t]() {
t();
bc.DecrementCount();
});
}
bc.Wait();
tasks.clear();
for (auto& temp : right_slices) {
delete temp;
}
right_slices.clear();
}
}
for (auto& left_slice : left_slices) {
for (auto& temp : left_slice) {
delete temp;
}
left_slice.clear();
}
}
| 0
|
263,495
|
static int sco_sock_accept(struct socket *sock, struct socket *newsock,
int flags, bool kern)
{
DEFINE_WAIT_FUNC(wait, woken_wake_function);
struct sock *sk = sock->sk, *ch;
long timeo;
int err = 0;
lock_sock(sk);
timeo = sock_rcvtimeo(sk, flags & O_NONBLOCK);
BT_DBG("sk %p timeo %ld", sk, timeo);
/* Wait for an incoming connection. (wake-one). */
add_wait_queue_exclusive(sk_sleep(sk), &wait);
while (1) {
if (sk->sk_state != BT_LISTEN) {
err = -EBADFD;
break;
}
ch = bt_accept_dequeue(sk, newsock);
if (ch)
break;
if (!timeo) {
err = -EAGAIN;
break;
}
if (signal_pending(current)) {
err = sock_intr_errno(timeo);
break;
}
release_sock(sk);
timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, timeo);
lock_sock(sk);
}
remove_wait_queue(sk_sleep(sk), &wait);
if (err)
goto done;
newsock->state = SS_CONNECTED;
BT_DBG("new socket %p", ch);
done:
release_sock(sk);
return err;
}
| 0
|
386,573
|
DL_Dxf::DL_Dxf() {
version = DL_VERSION_2000;
vertices = NULL;
maxVertices = 0;
vertexIndex = 0;
knots = NULL;
maxKnots = 0;
knotIndex = 0;
weights = NULL;
weightIndex = 0;
controlPoints = NULL;
maxControlPoints = 0;
controlPointIndex = 0;
fitPoints = NULL;
maxFitPoints = 0;
fitPointIndex = 0;
leaderVertices = NULL;
maxLeaderVertices = 0;
leaderVertexIndex = 0;
}
| 0
|
437,299
|
concat_opt_exact(OptExact* to, OptExact* add, OnigEncoding enc)
{
int i, j, len, r;
UChar *p, *end;
OptAnc tanc;
if (! to->ignore_case && add->ignore_case) {
if (to->len >= add->len) return 0; /* avoid */
to->ignore_case = 1;
}
r = 0;
p = add->s;
end = p + add->len;
for (i = to->len; p < end; ) {
len = enclen(enc, p);
if (i + len > OPT_EXACT_MAXLEN) {
r = 1; /* 1:full */
break;
}
for (j = 0; j < len && p < end; j++)
to->s[i++] = *p++;
}
to->len = i;
to->reach_end = (p == end ? add->reach_end : 0);
concat_opt_anc_info(&tanc, &to->anc, &add->anc, 1, 1);
if (! to->reach_end) tanc.right = 0;
copy_opt_anc_info(&to->anc, &tanc);
return r;
}
| 0
|
498,141
|
void html_header_arg_in_quotes(const char *txt)
{
const char *t = txt;
while (t && *t) {
unsigned char c = *t;
const char *e = NULL;
if (c == '\\')
e = "\\\\";
else if (c == '\r')
e = "\\r";
else if (c == '\n')
e = "\\n";
else if (c == '"')
e = "\\\"";
if (e) {
html_raw(txt, t - txt);
html(e);
txt = t + 1;
}
t++;
}
if (t != txt)
html(txt);
}
| 0
|
292,236
|
inbound_privmsg (server *serv, char *from, char *ip, char *text, int id,
const message_tags_data *tags_data)
{
session *sess;
struct User *user;
char idtext[64];
gboolean nodiag = FALSE;
sess = find_dialog (serv, from);
if (sess || prefs.hex_gui_autoopen_dialog)
{
/*0=ctcp 1=priv will set hex_gui_autoopen_dialog=0 here is flud detected */
if (!sess)
{
if (flood_check (from, ip, serv, current_sess, 1))
/* Create a dialog session */
sess = inbound_open_dialog (serv, from, tags_data);
else
sess = serv->server_session;
if (!sess)
return; /* ?? */
}
if (ip && ip[0])
set_topic (sess, ip, ip);
inbound_chanmsg (serv, NULL, NULL, from, text, FALSE, id, tags_data);
return;
}
sess = find_session_from_nick (from, serv);
if (!sess)
{
sess = serv->front_session;
nodiag = TRUE; /* We don't want it to look like a normal message in front sess */
}
user = userlist_find (sess, from);
if (user)
{
user->lasttalk = time (0);
if (user->account)
id = TRUE;
}
inbound_make_idtext (serv, idtext, sizeof (idtext), id);
if (sess->type == SESS_DIALOG && !nodiag)
EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0,
tags_data->timestamp);
else
EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVMSG, sess, from, text, idtext, NULL, 0,
tags_data->timestamp);
}
| 0
|
329,892
|
_cairo_image_bounded_spans (void *abstract_renderer,
int y, int height,
const cairo_half_open_span_t *spans,
unsigned num_spans)
{
cairo_image_span_renderer_t *r = abstract_renderer;
if (num_spans == 0)
return CAIRO_STATUS_SUCCESS;
do {
if (spans[0].coverage) {
pixman_image_compositor_blt (r->compositor,
spans[0].x, y,
spans[1].x - spans[0].x, height,
r->opacity * spans[0].coverage);
}
spans++;
} while (--num_spans > 1);
return CAIRO_STATUS_SUCCESS;
}
| 0
|
226,188
|
GF_Err rtp_hnti_box_size(GF_Box *s)
{
GF_RTPBox *ptr = (GF_RTPBox *)s;
ptr->size += 4 + strlen(ptr->sdpText);
return GF_OK;
}
| 0
|
242,936
|
static int ssl_handle_possible_reconnect( mbedtls_ssl_context *ssl )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t len;
if( ssl->conf->f_cookie_write == NULL ||
ssl->conf->f_cookie_check == NULL )
{
/* If we can't use cookies to verify reachability of the peer,
* drop the record. */
MBEDTLS_SSL_DEBUG_MSG( 1, ( "no cookie callbacks, "
"can't check reconnect validity" ) );
return( 0 );
}
ret = ssl_check_dtls_clihlo_cookie(
ssl,
ssl->cli_id, ssl->cli_id_len,
ssl->in_buf, ssl->in_left,
ssl->out_buf, MBEDTLS_SSL_OUT_CONTENT_LEN, &len );
MBEDTLS_SSL_DEBUG_RET( 2, "ssl_check_dtls_clihlo_cookie", ret );
if( ret == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED )
{
int send_ret;
MBEDTLS_SSL_DEBUG_MSG( 1, ( "sending HelloVerifyRequest" ) );
MBEDTLS_SSL_DEBUG_BUF( 4, "output record sent to network",
ssl->out_buf, len );
/* Don't check write errors as we can't do anything here.
* If the error is permanent we'll catch it later,
* if it's not, then hopefully it'll work next time. */
send_ret = ssl->f_send( ssl->p_bio, ssl->out_buf, len );
MBEDTLS_SSL_DEBUG_RET( 2, "ssl->f_send", send_ret );
(void) send_ret;
return( 0 );
}
if( ret == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "cookie is valid, resetting context" ) );
if( ( ret = mbedtls_ssl_session_reset_int( ssl, 1 ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "reset", ret );
return( ret );
}
return( MBEDTLS_ERR_SSL_CLIENT_RECONNECT );
}
return( ret );
}
| 0
|
310,330
|
dirserv_get_directory(void)
{
return dirserv_pick_cached_dir_obj(cached_directory, the_directory,
the_directory_is_dirty,
dirserv_regenerate_directory,
"v1 server directory", V1_AUTHORITY);
}
| 0
|
254,006
|
static unsigned int v4l2_loopback_poll(struct file *file, struct poll_table_struct *pts)
{
struct v4l2_loopback_opener *opener;
struct v4l2_loopback_device *dev;
int ret_mask = 0;
MARK();
opener = file->private_data;
dev = v4l2loopback_getdevice(file);
switch (opener->type) {
case WRITER:
ret_mask = POLLOUT | POLLWRNORM;
break;
case READER:
poll_wait(file, &dev->read_event, pts);
if (can_read(dev, opener))
ret_mask = POLLIN | POLLRDNORM;
break;
default:
ret_mask = -POLLERR;
}
MARK();
return ret_mask;
}
| 0
|
424,533
|
static UINT video_VideoData(VideoClientContext* context, TSMM_VIDEO_DATA* data)
{
VideoClientContextPriv* priv = context->priv;
PresentationContext* presentation;
int status;
presentation = priv->currentPresentation;
if (!presentation)
{
WLog_ERR(TAG, "no current presentation");
return CHANNEL_RC_OK;
}
if (presentation->PresentationId != data->PresentationId)
{
WLog_ERR(TAG, "current presentation id=%d doesn't match data id=%d",
presentation->PresentationId, data->PresentationId);
return CHANNEL_RC_OK;
}
if (!Stream_EnsureRemainingCapacity(presentation->currentSample, data->cbSample))
{
WLog_ERR(TAG, "unable to expand the current packet");
return CHANNEL_RC_NO_MEMORY;
}
Stream_Write(presentation->currentSample, data->pSample, data->cbSample);
if (data->CurrentPacketIndex == data->PacketsInSample)
{
H264_CONTEXT* h264 = presentation->h264;
UINT64 startTime = GetTickCount64(), timeAfterH264;
MAPPED_GEOMETRY* geom = presentation->geometry;
Stream_SealLength(presentation->currentSample);
Stream_SetPosition(presentation->currentSample, 0);
status = h264->subsystem->Decompress(h264, Stream_Pointer(presentation->currentSample),
Stream_Length(presentation->currentSample));
if (status == 0)
return CHANNEL_RC_OK;
if (status < 0)
return CHANNEL_RC_OK;
timeAfterH264 = GetTickCount64();
if (data->SampleNumber == 1)
{
presentation->lastPublishTime = startTime;
}
presentation->lastPublishTime += (data->hnsDuration / 10000);
if (presentation->lastPublishTime <= timeAfterH264 + 10)
{
int dropped = 0;
/* if the frame is to be published in less than 10 ms, let's consider it's now */
yuv_to_rgb(presentation, presentation->surfaceData);
context->showSurface(context, presentation->surface);
priv->publishedFrames++;
/* cleanup previously scheduled frames */
EnterCriticalSection(&priv->framesLock);
while (Queue_Count(priv->frames) > 0)
{
VideoFrame* frame = Queue_Dequeue(priv->frames);
if (frame)
{
priv->droppedFrames++;
VideoFrame_free(&frame);
dropped++;
}
}
LeaveCriticalSection(&priv->framesLock);
if (dropped)
WLog_DBG(TAG, "showing frame (%d dropped)", dropped);
}
else
{
BOOL enqueueResult;
VideoFrame* frame = calloc(1, sizeof(*frame));
if (!frame)
{
WLog_ERR(TAG, "unable to create frame");
return CHANNEL_RC_NO_MEMORY;
}
mappedGeometryRef(geom);
frame->presentation = presentation;
frame->publishTime = presentation->lastPublishTime;
frame->geometry = geom;
frame->w = presentation->SourceWidth;
frame->h = presentation->SourceHeight;
frame->surfaceData = BufferPool_Take(priv->surfacePool, frame->w * frame->h * 4);
if (!frame->surfaceData)
{
WLog_ERR(TAG, "unable to allocate frame data");
mappedGeometryUnref(geom);
free(frame);
return CHANNEL_RC_NO_MEMORY;
}
if (!yuv_to_rgb(presentation, frame->surfaceData))
{
WLog_ERR(TAG, "error during YUV->RGB conversion");
BufferPool_Return(priv->surfacePool, frame->surfaceData);
mappedGeometryUnref(geom);
free(frame);
return CHANNEL_RC_NO_MEMORY;
}
InterlockedIncrement(&presentation->refCounter);
EnterCriticalSection(&priv->framesLock);
enqueueResult = Queue_Enqueue(priv->frames, frame);
LeaveCriticalSection(&priv->framesLock);
if (!enqueueResult)
{
WLog_ERR(TAG, "unable to enqueue frame");
VideoFrame_free(&frame);
return CHANNEL_RC_NO_MEMORY;
}
WLog_DBG(TAG, "scheduling frame in %" PRIu32 " ms", (frame->publishTime - startTime));
}
}
return CHANNEL_RC_OK;
}
| 0
|
301,363
|
static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
{
int result;
bool has_dacl = False;
char *parent = NULL;
START_PROFILE(syscall_mkdir);
if (lp_inherit_acls(SNUM(handle->conn))
&& parent_dirname(talloc_tos(), path, &parent, NULL)
&& (has_dacl = directory_has_default_acl(handle->conn, parent)))
mode = (0777 & lp_dir_mask(SNUM(handle->conn)));
TALLOC_FREE(parent);
result = mkdir(path, mode);
if (result == 0 && !has_dacl) {
/*
* We need to do this as the default behavior of POSIX ACLs
* is to set the mask to be the requested group permission
* bits, not the group permission bits to be the requested
* group permission bits. This is not what we want, as it will
* mess up any inherited ACL bits that were set. JRA.
*/
int saved_errno = errno; /* We may get ENOSYS */
if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
errno = saved_errno;
}
END_PROFILE(syscall_mkdir);
return result;
}
| 0
|
333,040
|
re2post(void)
{
if (nfa_reg(REG_NOPAREN) == FAIL)
return NULL;
EMIT(NFA_MOPEN);
return post_start;
}
| 0
|
252,416
|
mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem,
size_t size, mz_uint32 flags) {
if (!mz_zip_reader_init_internal(pZip, flags)) return MZ_FALSE;
pZip->m_archive_size = size;
pZip->m_pRead = mz_zip_mem_read_func;
pZip->m_pIO_opaque = pZip;
#ifdef __cplusplus
pZip->m_pState->m_pMem = const_cast<void *>(pMem);
#else
pZip->m_pState->m_pMem = (void *)pMem;
#endif
pZip->m_pState->m_mem_size = size;
if (!mz_zip_reader_read_central_dir(pZip, flags)) {
mz_zip_reader_end(pZip);
return MZ_FALSE;
}
return MZ_TRUE;
}
| 0
|
386,512
|
void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) {
dw.dxfString( 0, "BLOCK_RECORD");
if (version==DL_VERSION_2000) {
dw.handle();
}
//dw->dxfHex(330, 1);
if (version==DL_VERSION_2000) {
dw.dxfString(100, "AcDbSymbolTableRecord");
dw.dxfString(100, "AcDbBlockTableRecord");
}
dw.dxfString( 2, name);
dw.dxfHex(340, 0);
}
| 0
|
274,861
|
TEST(ComparisonsTest, LessEqualFloat) {
ComparisonOpModel model({1, 1, 1, 4}, {1, 1, 1, 4}, TensorType_FLOAT32,
BuiltinOperator_LESS_EQUAL);
model.PopulateTensor<float>(model.input1(), {0.1, 0.9, 0.7, 0.3});
model.PopulateTensor<float>(model.input2(), {0.1, 0.2, 0.6, 0.5});
model.Invoke();
EXPECT_THAT(model.GetOutput(), ElementsAre(true, false, false, true));
EXPECT_THAT(model.GetOutputShape(), ElementsAre(1, 1, 1, 4));
}
| 0
|
484,772
|
static int xennet_connect(struct net_device *dev)
{
struct netfront_info *np = netdev_priv(dev);
unsigned int num_queues = 0;
int err;
unsigned int j = 0;
struct netfront_queue *queue = NULL;
if (!xenbus_read_unsigned(np->xbdev->otherend, "feature-rx-copy", 0)) {
dev_info(&dev->dev,
"backend does not support copying receive path\n");
return -ENODEV;
}
err = talk_to_netback(np->xbdev, np);
if (err)
return err;
if (np->netback_has_xdp_headroom)
pr_info("backend supports XDP headroom\n");
if (np->bounce)
dev_info(&np->xbdev->dev,
"bouncing transmitted data to zeroed pages\n");
/* talk_to_netback() sets the correct number of queues */
num_queues = dev->real_num_tx_queues;
if (dev->reg_state == NETREG_UNINITIALIZED) {
err = register_netdev(dev);
if (err) {
pr_warn("%s: register_netdev err=%d\n", __func__, err);
device_unregister(&np->xbdev->dev);
return err;
}
}
rtnl_lock();
netdev_update_features(dev);
rtnl_unlock();
/*
* All public and private state should now be sane. Get
* ready to start sending and receiving packets and give the driver
* domain a kick because we've probably just requeued some
* packets.
*/
netif_tx_lock_bh(np->netdev);
netif_device_attach(np->netdev);
netif_tx_unlock_bh(np->netdev);
netif_carrier_on(np->netdev);
for (j = 0; j < num_queues; ++j) {
queue = &np->queues[j];
notify_remote_via_irq(queue->tx_irq);
if (queue->tx_irq != queue->rx_irq)
notify_remote_via_irq(queue->rx_irq);
spin_lock_irq(&queue->tx_lock);
xennet_tx_buf_gc(queue);
spin_unlock_irq(&queue->tx_lock);
spin_lock_bh(&queue->rx_lock);
xennet_alloc_rx_buffers(queue);
spin_unlock_bh(&queue->rx_lock);
}
return 0;
}
| 0
|
294,431
|
m_amjd(union DateData *x)
{
VALUE r, sf;
int df;
r = m_real_jd(x);
if (FIXNUM_P(r) && FIX2LONG(r) >= (FIXNUM_MIN + 2400001)) {
long ir = FIX2LONG(r);
ir -= 2400001;
r = rb_rational_new1(LONG2FIX(ir));
}
else
r = rb_rational_new1(f_sub(m_real_jd(x),
INT2FIX(2400001)));
if (simple_dat_p(x))
return r;
df = m_df(x);
if (df)
r = f_add(r, isec_to_day(df));
sf = m_sf(x);
if (f_nonzero_p(sf))
r = f_add(r, ns_to_day(sf));
return r;
}
| 0
|
352,954
|
serialNumberAndIssuerValidate(
Syntax *syntax,
struct berval *in )
{
int rc;
struct berval sn, i;
Debug( LDAP_DEBUG_TRACE, ">>> serialNumberAndIssuerValidate: <%s>\n",
in->bv_val );
rc = serialNumberAndIssuerCheck( in, &sn, &i, NULL );
if ( rc ) {
goto done;
}
/* validate DN -- doesn't handle double dquote */
rc = dnValidate( NULL, &i );
if ( rc ) {
rc = LDAP_INVALID_SYNTAX;
}
if ( in->bv_val[0] == '{' && in->bv_val[in->bv_len-1] == '}' ) {
slap_sl_free( i.bv_val, NULL );
}
Debug( LDAP_DEBUG_TRACE, "<<< serialNumberAndIssuerValidate: <%s> err=%d\n",
in->bv_val, rc );
done:;
return rc;
}
| 0
|
437,674
|
static inline void control_tx_modulation_enable(struct cx23885_dev *dev,
bool enable)
{
cx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_MOD,
enable ? CNTRL_MOD : 0);
}
| 0
|
215,992
|
load_image (const gchar *filename,
GError **error)
{
FILE *fp;
tga_info info;
guchar header[18];
guchar footer[26];
guchar extension[495];
long offset;
gint32 image_ID = -1;
gimp_progress_init_printf (_("Opening '%s'"),
gimp_filename_to_utf8 (filename));
fp = g_fopen (filename, "rb");
if (! fp)
{
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));
return -1;
}
/* Is file big enough for a footer? */
if (!fseek (fp, -26L, SEEK_END))
{
if (fread (footer, sizeof (footer), 1, fp) != 1)
{
g_message (_("Cannot read footer from '%s'"),
gimp_filename_to_utf8 (filename));
return -1;
}
else if (memcmp (footer + 8, magic, sizeof (magic)) == 0)
{
/* Check the signature. */
offset = (footer[0] +
footer[1] * 256L +
footer[2] * 65536L +
footer[3] * 16777216L);
if (offset != 0)
{
if (fseek (fp, offset, SEEK_SET) ||
fread (extension, sizeof (extension), 1, fp) != 1)
{
g_message (_("Cannot read extension from '%s'"),
gimp_filename_to_utf8 (filename));
return -1;
}
/* Eventually actually handle version 2 TGA here */
}
}
}
if (fseek (fp, 0, SEEK_SET) ||
fread (header, sizeof (header), 1, fp) != 1)
{
g_message (_("Cannot read header from '%s'"),
gimp_filename_to_utf8 (filename));
return -1;
}
switch (header[2])
{
case 1:
info.imageType = TGA_TYPE_MAPPED;
info.imageCompression = TGA_COMP_NONE;
break;
case 2:
info.imageType = TGA_TYPE_COLOR;
info.imageCompression = TGA_COMP_NONE;
break;
case 3:
info.imageType = TGA_TYPE_GRAY;
info.imageCompression = TGA_COMP_NONE;
break;
case 9:
info.imageType = TGA_TYPE_MAPPED;
info.imageCompression = TGA_COMP_RLE;
break;
case 10:
info.imageType = TGA_TYPE_COLOR;
info.imageCompression = TGA_COMP_RLE;
break;
case 11:
info.imageType = TGA_TYPE_GRAY;
info.imageCompression = TGA_COMP_RLE;
break;
default:
info.imageType = 0;
}
info.idLength = header[0];
info.colorMapType = header[1];
info.colorMapIndex = header[3] + header[4] * 256;
info.colorMapLength = header[5] + header[6] * 256;
info.colorMapSize = header[7];
info.xOrigin = header[8] + header[9] * 256;
info.yOrigin = header[10] + header[11] * 256;
info.width = header[12] + header[13] * 256;
info.height = header[14] + header[15] * 256;
info.bpp = header[16];
info.bytes = (info.bpp + 7) / 8;
info.alphaBits = header[17] & 0x0f; /* Just the low 4 bits */
info.flipHoriz = (header[17] & 0x10) ? 1 : 0;
info.flipVert = (header[17] & 0x20) ? 0 : 1;
/* hack to handle some existing files with incorrect headers, see bug #306675 */
if (info.alphaBits == info.bpp)
info.alphaBits = 0;
/* hack to handle yet another flavor of incorrect headers, see bug #540969 */
if (info.alphaBits == 0)
{
if (info.imageType == TGA_TYPE_COLOR && info.bpp == 32)
info.alphaBits = 8;
if (info.imageType == TGA_TYPE_GRAY && info.bpp == 16)
info.alphaBits = 8;
}
switch (info.imageType)
{
case TGA_TYPE_MAPPED:
if (info.bpp != 8)
{
g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
gimp_filename_to_utf8 (filename),
info.imageType, info.bpp);
return -1;
}
break;
case TGA_TYPE_COLOR:
if (info.bpp != 15 && info.bpp != 16 &&
info.bpp != 24 && info.bpp != 32)
{
g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
gimp_filename_to_utf8 (filename),
info.imageType, info.bpp);
return -1;
}
break;
case TGA_TYPE_GRAY:
if (info.bpp != 8 &&
(info.alphaBits != 8 || (info.bpp != 16 && info.bpp != 15)))
{
g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
gimp_filename_to_utf8 (filename),
info.imageType, info.bpp);
return -1;
}
break;
default:
g_message ("Unknown image type %u for '%s'",
info.imageType, gimp_filename_to_utf8 (filename));
return -1;
}
/* Plausible but unhandled formats */
if (info.bytes * 8 != info.bpp && info.bpp != 15)
{
g_message ("Unhandled sub-format in '%s' (type = %u, bpp = %u)",
gimp_filename_to_utf8 (filename),
info.imageType, info.bpp);
return -1;
}
/* Check that we have a color map only when we need it. */
if (info.imageType == TGA_TYPE_MAPPED && info.colorMapType != 1)
{
g_message ("Indexed image has invalid color map type %u",
info.colorMapType);
return -1;
}
else if (info.imageType != TGA_TYPE_MAPPED && info.colorMapType != 0)
{
g_message ("Non-indexed image has invalid color map type %u",
info.colorMapType);
return -1;
}
/* Skip the image ID field. */
if (info.idLength && fseek (fp, info.idLength, SEEK_CUR))
{
g_message ("File '%s' is truncated or corrupted",
gimp_filename_to_utf8 (filename));
return -1;
}
image_ID = ReadImage (fp, &info, filename);
fclose (fp);
return image_ID;
}
| 1
|
216,027
|
pax_decode_header (struct tar_sparse_file *file)
{
if (file->stat_info->sparse_major > 0)
{
uintmax_t u;
char nbuf[UINTMAX_STRSIZE_BOUND];
union block *blk;
char *p;
size_t i;
off_t start;
#define COPY_BUF(b,buf,src) do \
{ \
char *endp = b->buffer + BLOCKSIZE; \
char *dst = buf; \
do \
{ \
if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \
{ \
ERROR ((0, 0, _("%s: numeric overflow in sparse archive member"), \
file->stat_info->orig_file_name)); \
return false; \
} \
if (src == endp) \
{ \
set_next_block_after (b); \
b = find_next_block (); \
src = b->buffer; \
endp = b->buffer + BLOCKSIZE; \
} \
*dst = *src++; \
} \
while (*dst++ != '\n'); \
dst[-1] = 0; \
} while (0)
start = current_block_ordinal ();
set_next_block_after (current_header);
blk = find_next_block ();
p = blk->buffer;
COPY_BUF (blk,nbuf,p);
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t)))
{
ERROR ((0, 0, _("%s: malformed sparse archive member"),
file->stat_info->orig_file_name));
return false;
}
file->stat_info->sparse_map_size = u;
file->stat_info->sparse_map = xcalloc (file->stat_info->sparse_map_size,
sizeof (*file->stat_info->sparse_map));
file->stat_info->sparse_map_avail = 0;
for (i = 0; i < file->stat_info->sparse_map_size; i++)
{
struct sp_array sp;
COPY_BUF (blk,nbuf,p);
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
{
ERROR ((0, 0, _("%s: malformed sparse archive member"),
file->stat_info->orig_file_name));
return false;
}
sp.offset = u;
COPY_BUF (blk,nbuf,p);
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
{
ERROR ((0, 0, _("%s: malformed sparse archive member"),
file->stat_info->orig_file_name));
return false;
}
sp.numbytes = u;
sparse_add_map (file->stat_info, &sp);
}
set_next_block_after (blk);
file->dumped_size += BLOCKSIZE * (current_block_ordinal () - start);
}
return true;
}
| 1
|
455,390
|
__xfs_inode_free(
struct xfs_inode *ip)
{
/* asserts to verify all state is correct here */
ASSERT(atomic_read(&ip->i_pincount) == 0);
XFS_STATS_DEC(ip->i_mount, vn_active);
call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback);
}
| 0
|
238,323
|
struct digest *digest_alloc(const char *name)
{
struct digest *d;
struct digest_algo *algo;
algo = digest_algo_get_by_name(name);
if (!algo)
return NULL;
d = xzalloc(sizeof(*d));
d->algo = algo;
d->ctx = xzalloc(algo->ctx_length);
if (d->algo->alloc(d)) {
digest_free(d);
return NULL;
}
return d;
}
| 0
|
294,648
|
offset_to_sec(VALUE vof, int *rof)
{
int try_rational = 1;
again:
switch (TYPE(vof)) {
case T_FIXNUM:
{
long n;
n = FIX2LONG(vof);
if (n != -1 && n != 0 && n != 1)
return 0;
*rof = (int)n * DAY_IN_SECONDS;
return 1;
}
case T_FLOAT:
{
double n;
n = RFLOAT_VALUE(vof) * DAY_IN_SECONDS;
if (n < -DAY_IN_SECONDS || n > DAY_IN_SECONDS)
return 0;
*rof = (int)round(n);
if (*rof != n)
rb_warning("fraction of offset is ignored");
return 1;
}
default:
expect_numeric(vof);
vof = f_to_r(vof);
if (!k_rational_p(vof)) {
if (!try_rational) Check_Type(vof, T_RATIONAL);
try_rational = 0;
goto again;
}
/* fall through */
case T_RATIONAL:
{
VALUE vs, vn, vd;
long n;
vs = day_to_sec(vof);
if (!k_rational_p(vs)) {
vn = vs;
goto rounded;
}
vn = rb_rational_num(vs);
vd = rb_rational_den(vs);
if (FIXNUM_P(vn) && FIXNUM_P(vd) && (FIX2LONG(vd) == 1))
n = FIX2LONG(vn);
else {
vn = f_round(vs);
if (!f_eqeq_p(vn, vs))
rb_warning("fraction of offset is ignored");
rounded:
if (!FIXNUM_P(vn))
return 0;
n = FIX2LONG(vn);
if (n < -DAY_IN_SECONDS || n > DAY_IN_SECONDS)
return 0;
}
*rof = (int)n;
return 1;
}
case T_STRING:
{
VALUE vs = date_zone_to_diff(vof);
long n;
if (!FIXNUM_P(vs))
return 0;
n = FIX2LONG(vs);
if (n < -DAY_IN_SECONDS || n > DAY_IN_SECONDS)
return 0;
*rof = (int)n;
return 1;
}
}
return 0;
}
| 0
|
313,758
|
find_is_eval_item(
char_u *ptr,
int *colp,
int *bnp,
int dir)
{
// Accept everything inside [].
if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD))
++*bnp;
if (*bnp > 0)
{
if ((*ptr == '[' && dir == BACKWARD) || (*ptr == ']' && dir == FORWARD))
--*bnp;
return TRUE;
}
// skip over "s.var"
if (*ptr == '.')
return TRUE;
// two-character item: s->var
if (ptr[dir == BACKWARD ? 0 : 1] == '>'
&& ptr[dir == BACKWARD ? -1 : 0] == '-')
{
*colp += dir;
return TRUE;
}
return FALSE;
}
| 0
|
270,765
|
int passwd_env_disable(void)
{
return unlink(PASSWD_FILE);
}
| 0
|
253,552
|
smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2)
{
return ob1->fid.persistent_fid == ob2->fid.persistent_fid &&
ob1->fid.volatile_fid == ob2->fid.volatile_fid;
}
| 0
|
308,160
|
static void fastrpc_map_get(struct fastrpc_map *map)
{
if (map)
kref_get(&map->refcount);
}
| 0
|
267,956
|
static RBinPlugin *get_plugin_from_buffer(RBin *bin, RBinFile *bf, const char *pluginname, RBuffer *buf) {
RBinPlugin *plugin = bin->force? r_bin_get_binplugin_by_name (bin, bin->force): NULL;
if (plugin) {
return plugin;
}
plugin = pluginname? r_bin_get_binplugin_by_name (bin, pluginname): NULL;
if (plugin) {
return plugin;
}
plugin = r_bin_get_binplugin_by_buffer (bin, bf, buf);
if (plugin) {
return plugin;
}
return r_bin_get_binplugin_by_name (bin, "any");
}
| 0
|
383,322
|
gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)
{
int c;
int x, y;
int tox, toy;
int ydest;
int i;
int colorMap[gdMaxColors];
/* Stretch vectors */
int *stx, *sty;
/* We only need to use floating point to determine the correct stretch vector for one line's worth. */
double accum;
stx = (int *) gdMalloc (sizeof (int) * srcW);
sty = (int *) gdMalloc (sizeof (int) * srcH);
accum = 0;
for (i = 0; (i < srcW); i++) {
int got;
accum += (double) dstW / (double) srcW;
got = (int) floor (accum);
stx[i] = got;
accum -= got;
}
accum = 0;
for (i = 0; (i < srcH); i++) {
int got;
accum += (double) dstH / (double) srcH;
got = (int) floor (accum);
sty[i] = got;
accum -= got;
}
for (i = 0; (i < gdMaxColors); i++) {
colorMap[i] = (-1);
}
toy = dstY;
for (y = srcY; (y < (srcY + srcH)); y++) {
for (ydest = 0; (ydest < sty[y - srcY]); ydest++) {
tox = dstX;
for (x = srcX; (x < (srcX + srcW)); x++) {
int nc = 0;
int mapTo;
if (!stx[x - srcX]) {
continue;
}
if (dst->trueColor) {
/* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */
if (!src->trueColor) {
int tmp = gdImageGetPixel (src, x, y);
mapTo = gdImageGetTrueColorPixel (src, x, y);
if (gdImageGetTransparent (src) == tmp) {
tox++;
continue;
}
} else {
/* TK: old code follows */
mapTo = gdImageGetTrueColorPixel (src, x, y);
/* Added 7/24/95: support transparent copies */
if (gdImageGetTransparent (src) == mapTo) {
tox++;
continue;
}
}
} else {
c = gdImageGetPixel (src, x, y);
/* Added 7/24/95: support transparent copies */
if (gdImageGetTransparent (src) == c) {
tox += stx[x - srcX];
continue;
}
if (src->trueColor) {
/* Remap to the palette available in the destination image. This is slow and works badly. */
mapTo = gdImageColorResolveAlpha(dst, gdTrueColorGetRed(c),
gdTrueColorGetGreen(c),
gdTrueColorGetBlue(c),
gdTrueColorGetAlpha (c));
} else {
/* Have we established a mapping for this color? */
if (colorMap[c] == (-1)) {
/* If it's the same image, mapping is trivial */
if (dst == src) {
nc = c;
} else {
/* Find or create the best match */
/* 2.0.5: can't use gdTrueColorGetRed, etc with palette */
nc = gdImageColorResolveAlpha(dst, gdImageRed(src, c),
gdImageGreen(src, c),
gdImageBlue(src, c),
gdImageAlpha(src, c));
}
colorMap[c] = nc;
}
mapTo = colorMap[c];
}
}
for (i = 0; (i < stx[x - srcX]); i++) {
gdImageSetPixel (dst, tox, toy, mapTo);
tox++;
}
}
toy++;
}
}
gdFree (stx);
gdFree (sty);
}
| 0
|
247,722
|
const std::string& expectedCiphersuite() const { return expected_cipher_suite_; }
| 0
|
459,515
|
static inline int stack_map_data_size(struct bpf_map *map)
{
return stack_map_use_build_id(map) ?
sizeof(struct bpf_stack_build_id) : sizeof(u64);
}
| 0
|
244,127
|
GF_Box *mvcg_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_MultiviewGroupBox, GF_ISOM_BOX_TYPE_MVCG);
return (GF_Box *)tmp;
}
| 0
|
487,633
|
asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
unsigned long arg4, unsigned long arg5)
{
long error;
error = security_task_prctl(option, arg2, arg3, arg4, arg5);
if (error)
return error;
switch (option) {
case PR_SET_PDEATHSIG:
if (!valid_signal(arg2)) {
error = -EINVAL;
break;
}
current->pdeath_signal = arg2;
break;
case PR_GET_PDEATHSIG:
error = put_user(current->pdeath_signal, (int __user *)arg2);
break;
case PR_GET_DUMPABLE:
error = current->mm->dumpable;
break;
case PR_SET_DUMPABLE:
if (arg2 < 0 || arg2 > 1) {
error = -EINVAL;
break;
}
current->mm->dumpable = arg2;
break;
case PR_SET_UNALIGN:
error = SET_UNALIGN_CTL(current, arg2);
break;
case PR_GET_UNALIGN:
error = GET_UNALIGN_CTL(current, arg2);
break;
case PR_SET_FPEMU:
error = SET_FPEMU_CTL(current, arg2);
break;
case PR_GET_FPEMU:
error = GET_FPEMU_CTL(current, arg2);
break;
case PR_SET_FPEXC:
error = SET_FPEXC_CTL(current, arg2);
break;
case PR_GET_FPEXC:
error = GET_FPEXC_CTL(current, arg2);
break;
case PR_GET_TIMING:
error = PR_TIMING_STATISTICAL;
break;
case PR_SET_TIMING:
if (arg2 == PR_TIMING_STATISTICAL)
error = 0;
else
error = -EINVAL;
break;
case PR_GET_KEEPCAPS:
if (current->keep_capabilities)
error = 1;
break;
case PR_SET_KEEPCAPS:
if (arg2 != 0 && arg2 != 1) {
error = -EINVAL;
break;
}
current->keep_capabilities = arg2;
break;
case PR_SET_NAME: {
struct task_struct *me = current;
unsigned char ncomm[sizeof(me->comm)];
ncomm[sizeof(me->comm)-1] = 0;
if (strncpy_from_user(ncomm, (char __user *)arg2,
sizeof(me->comm)-1) < 0)
return -EFAULT;
set_task_comm(me, ncomm);
return 0;
}
case PR_GET_NAME: {
struct task_struct *me = current;
unsigned char tcomm[sizeof(me->comm)];
get_task_comm(tcomm, me);
if (copy_to_user((char __user *)arg2, tcomm, sizeof(tcomm)))
return -EFAULT;
return 0;
}
case PR_GET_ENDIAN:
error = GET_ENDIAN(current, arg2);
break;
case PR_SET_ENDIAN:
error = SET_ENDIAN(current, arg2);
break;
default:
error = -EINVAL;
break;
}
return error;
}
| 0
|
329,889
|
fill_boxes (void *_dst,
cairo_operator_t op,
const cairo_color_t *color,
cairo_boxes_t *boxes)
{
cairo_image_surface_t *dst = _dst;
struct _cairo_boxes_chunk *chunk;
uint32_t pixel;
int i;
TRACE ((stderr, "%s x %d\n", __FUNCTION__, boxes->num_boxes));
if (fill_reduces_to_source (op, color, dst, &pixel)) {
for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
for (i = 0; i < chunk->count; i++) {
int x = _cairo_fixed_integer_part (chunk->base[i].p1.x);
int y = _cairo_fixed_integer_part (chunk->base[i].p1.y);
int w = _cairo_fixed_integer_part (chunk->base[i].p2.x) - x;
int h = _cairo_fixed_integer_part (chunk->base[i].p2.y) - y;
pixman_fill ((uint32_t *) dst->data,
dst->stride / sizeof (uint32_t),
PIXMAN_FORMAT_BPP (dst->pixman_format),
x, y, w, h, pixel);
}
}
}
else
{
pixman_image_t *src = _pixman_image_for_color (color);
if (unlikely (src == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
op = _pixman_operator (op);
for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
for (i = 0; i < chunk->count; i++) {
int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
pixman_image_composite32 (op,
src, NULL, dst->pixman_image,
0, 0,
0, 0,
x1, y1,
x2-x1, y2-y1);
}
}
pixman_image_unref (src);
}
return CAIRO_STATUS_SUCCESS;
}
| 0
|
369,197
|
static __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f)
{
struct io_ring_ctx *ctx = f->private_data;
if (percpu_ref_tryget(&ctx->refs)) {
__io_uring_show_fdinfo(ctx, m);
percpu_ref_put(&ctx->refs);
}
| 0
|
223,372
|
static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_list **list, struct sljit_jump *jump)
{
jump_list *list_item = sljit_alloc_memory(compiler, sizeof(jump_list));
if (list_item)
{
list_item->next = *list;
list_item->jump = jump;
*list = list_item;
}
}
| 0
|
310,118
|
init_xterm_mouse(SCREEN *sp)
{
sp->_mouse_type = M_XTERM;
sp->_mouse_format = MF_X10;
sp->_mouse_xtermcap = tigetstr("XM");
if (VALID_STRING(sp->_mouse_xtermcap)) {
char *code = strstr(sp->_mouse_xtermcap, "[?");
if (code != 0) {
code += 2;
while ((*code >= '0') && (*code <= '9')) {
char *next = code;
while ((*next >= '0') && (*next <= '9')) {
++next;
}
if (!strncmp(code, "1006", (size_t) (next - code))) {
sp->_mouse_format = MF_SGR1006;
}
#ifdef EXP_XTERM_1005
if (!strncmp(code, "1005", (size_t) (next - code))) {
sp->_mouse_format = MF_XTERM_1005;
}
#endif
if (*next == ';') {
while (*next == ';') {
++next;
}
code = next;
} else {
break;
}
}
}
} else {
int code = tigetnum("XM");
switch (code) {
case 1006:
break;
default:
code = 1000;
break;
}
sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
}
}
| 0
|
209,049
|
xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
const xmlChar **URI, int *tlen) {
const xmlChar *localname;
const xmlChar *prefix;
const xmlChar *attname;
const xmlChar *aprefix;
const xmlChar *nsname;
xmlChar *attvalue;
const xmlChar **atts = ctxt->atts;
int maxatts = ctxt->maxatts;
int nratts, nbatts, nbdef;
int i, j, nbNs, attval, oldline, oldcol;
const xmlChar *base;
unsigned long cur;
int nsNr = ctxt->nsNr;
if (RAW != '<') return(NULL);
NEXT1;
/*
* NOTE: it is crucial with the SAX2 API to never call SHRINK beyond that
* point since the attribute values may be stored as pointers to
* the buffer and calling SHRINK would destroy them !
* The Shrinking is only possible once the full set of attribute
* callbacks have been done.
*/
reparse:
SHRINK;
base = ctxt->input->base;
cur = ctxt->input->cur - ctxt->input->base;
oldline = ctxt->input->line;
oldcol = ctxt->input->col;
nbatts = 0;
nratts = 0;
nbdef = 0;
nbNs = 0;
attval = 0;
/* Forget any namespaces added during an earlier parse of this element. */
ctxt->nsNr = nsNr;
localname = xmlParseQName(ctxt, &prefix);
if (localname == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"StartTag: invalid element name\n");
return(NULL);
}
*tlen = ctxt->input->cur - ctxt->input->base - cur;
/*
* Now parse the attributes, it ends up with the ending
*
* (S Attribute)* S?
*/
SKIP_BLANKS;
GROW;
if (ctxt->input->base != base) goto base_changed;
while (((RAW != '>') &&
((RAW != '/') || (NXT(1) != '>')) &&
(IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *q = CUR_PTR;
unsigned int cons = ctxt->input->consumed;
int len = -1, alloc = 0;
attname = xmlParseAttribute2(ctxt, prefix, localname,
&aprefix, &attvalue, &len, &alloc);
if (ctxt->input->base != base) {
if ((attvalue != NULL) && (alloc != 0))
xmlFree(attvalue);
attvalue = NULL;
goto base_changed;
}
if ((attname != NULL) && (attvalue != NULL)) {
if (len < 0) len = xmlStrlen(attvalue);
if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
xmlURIPtr uri;
if (URL == NULL) {
xmlErrMemory(ctxt, "dictionary allocation failure");
if ((attvalue != NULL) && (alloc != 0))
xmlFree(attvalue);
return(NULL);
}
if (*URL != 0) {
uri = xmlParseURI((const char *) URL);
if (uri == NULL) {
xmlNsErr(ctxt, XML_WAR_NS_URI,
"xmlns: '%s' is not a valid URI\n",
URL, NULL, NULL);
} else {
if (uri->scheme == NULL) {
xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
"xmlns: URI %s is not absolute\n",
URL, NULL, NULL);
}
xmlFreeURI(uri);
}
if (URL == ctxt->str_xml_ns) {
if (attname != ctxt->str_xml) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"xml namespace URI cannot be the default namespace\n",
NULL, NULL, NULL);
}
goto skip_default_ns;
}
if ((len == 29) &&
(xmlStrEqual(URL,
BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"reuse of the xmlns namespace name is forbidden\n",
NULL, NULL, NULL);
goto skip_default_ns;
}
}
/*
* check that it's not a defined namespace
*/
for (j = 1;j <= nbNs;j++)
if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
break;
if (j <= nbNs)
xmlErrAttributeDup(ctxt, NULL, attname);
else
if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
skip_default_ns:
if (alloc != 0) xmlFree(attvalue);
if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
break;
if (!IS_BLANK_CH(RAW)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
break;
}
SKIP_BLANKS;
continue;
}
if (aprefix == ctxt->str_xmlns) {
const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len);
xmlURIPtr uri;
if (attname == ctxt->str_xml) {
if (URL != ctxt->str_xml_ns) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"xml namespace prefix mapped to wrong URI\n",
NULL, NULL, NULL);
}
/*
* Do not keep a namespace definition node
*/
goto skip_ns;
}
if (URL == ctxt->str_xml_ns) {
if (attname != ctxt->str_xml) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"xml namespace URI mapped to wrong prefix\n",
NULL, NULL, NULL);
}
goto skip_ns;
}
if (attname == ctxt->str_xmlns) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"redefinition of the xmlns prefix is forbidden\n",
NULL, NULL, NULL);
goto skip_ns;
}
if ((len == 29) &&
(xmlStrEqual(URL,
BAD_CAST "http://www.w3.org/2000/xmlns/"))) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"reuse of the xmlns namespace name is forbidden\n",
NULL, NULL, NULL);
goto skip_ns;
}
if ((URL == NULL) || (URL[0] == 0)) {
xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE,
"xmlns:%s: Empty XML namespace is not allowed\n",
attname, NULL, NULL);
goto skip_ns;
} else {
uri = xmlParseURI((const char *) URL);
if (uri == NULL) {
xmlNsErr(ctxt, XML_WAR_NS_URI,
"xmlns:%s: '%s' is not a valid URI\n",
attname, URL, NULL);
} else {
if ((ctxt->pedantic) && (uri->scheme == NULL)) {
xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE,
"xmlns:%s: URI %s is not absolute\n",
attname, URL, NULL);
}
xmlFreeURI(uri);
}
}
/*
* check that it's not a defined namespace
*/
for (j = 1;j <= nbNs;j++)
if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
break;
if (j <= nbNs)
xmlErrAttributeDup(ctxt, aprefix, attname);
else
if (nsPush(ctxt, attname, URL) > 0) nbNs++;
skip_ns:
if (alloc != 0) xmlFree(attvalue);
if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
break;
if (!IS_BLANK_CH(RAW)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
break;
}
SKIP_BLANKS;
if (ctxt->input->base != base) goto base_changed;
continue;
}
/*
* Add the pair to atts
*/
if ((atts == NULL) || (nbatts + 5 > maxatts)) {
if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
if (attvalue[len] == 0)
xmlFree(attvalue);
goto failed;
}
maxatts = ctxt->maxatts;
atts = ctxt->atts;
}
ctxt->attallocs[nratts++] = alloc;
atts[nbatts++] = attname;
atts[nbatts++] = aprefix;
atts[nbatts++] = NULL; /* the URI will be fetched later */
atts[nbatts++] = attvalue;
attvalue += len;
atts[nbatts++] = attvalue;
/*
* tag if some deallocation is needed
*/
if (alloc != 0) attval = 1;
} else {
if ((attvalue != NULL) && (attvalue[len] == 0))
xmlFree(attvalue);
}
failed:
GROW
if (ctxt->instate == XML_PARSER_EOF)
break;
if (ctxt->input->base != base) goto base_changed;
if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
break;
if (!IS_BLANK_CH(RAW)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"attributes construct error\n");
break;
}
SKIP_BLANKS;
if ((cons == ctxt->input->consumed) && (q == CUR_PTR) &&
(attname == NULL) && (attvalue == NULL)) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"xmlParseStartTag: problem parsing attributes\n");
break;
}
GROW;
if (ctxt->input->base != base) goto base_changed;
}
/*
* The attributes defaulting
*/
if (ctxt->attsDefault != NULL) {
xmlDefAttrsPtr defaults;
defaults = xmlHashLookup2(ctxt->attsDefault, localname, prefix);
if (defaults != NULL) {
for (i = 0;i < defaults->nbAttrs;i++) {
attname = defaults->values[5 * i];
aprefix = defaults->values[5 * i + 1];
/*
* special work for namespaces defaulted defs
*/
if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) {
/*
* check that it's not a defined namespace
*/
for (j = 1;j <= nbNs;j++)
if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL)
break;
if (j <= nbNs) continue;
nsname = xmlGetNamespace(ctxt, NULL);
if (nsname != defaults->values[5 * i + 2]) {
if (nsPush(ctxt, NULL,
defaults->values[5 * i + 2]) > 0)
nbNs++;
}
} else if (aprefix == ctxt->str_xmlns) {
/*
* check that it's not a defined namespace
*/
for (j = 1;j <= nbNs;j++)
if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname)
break;
if (j <= nbNs) continue;
nsname = xmlGetNamespace(ctxt, attname);
if (nsname != defaults->values[2]) {
if (nsPush(ctxt, attname,
defaults->values[5 * i + 2]) > 0)
nbNs++;
}
} else {
/*
* check that it's not a defined attribute
*/
for (j = 0;j < nbatts;j+=5) {
if ((attname == atts[j]) && (aprefix == atts[j+1]))
break;
}
if (j < nbatts) continue;
if ((atts == NULL) || (nbatts + 5 > maxatts)) {
if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
return(NULL);
}
maxatts = ctxt->maxatts;
atts = ctxt->atts;
}
atts[nbatts++] = attname;
atts[nbatts++] = aprefix;
if (aprefix == NULL)
atts[nbatts++] = NULL;
else
atts[nbatts++] = xmlGetNamespace(ctxt, aprefix);
atts[nbatts++] = defaults->values[5 * i + 2];
atts[nbatts++] = defaults->values[5 * i + 3];
if ((ctxt->standalone == 1) &&
(defaults->values[5 * i + 4] != NULL)) {
xmlValidityError(ctxt, XML_DTD_STANDALONE_DEFAULTED,
"standalone: attribute %s on %s defaulted from external subset\n",
attname, localname);
}
nbdef++;
}
}
}
}
/*
* The attributes checkings
*/
for (i = 0; i < nbatts;i += 5) {
/*
* The default namespace does not apply to attribute names.
*/
if (atts[i + 1] != NULL) {
nsname = xmlGetNamespace(ctxt, atts[i + 1]);
if (nsname == NULL) {
xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s for %s on %s is not defined\n",
atts[i + 1], atts[i], localname);
}
atts[i + 2] = nsname;
} else
nsname = NULL;
/*
* [ WFC: Unique Att Spec ]
* No attribute name may appear more than once in the same
* start-tag or empty-element tag.
* As extended by the Namespace in XML REC.
*/
for (j = 0; j < i;j += 5) {
if (atts[i] == atts[j]) {
if (atts[i+1] == atts[j+1]) {
xmlErrAttributeDup(ctxt, atts[i+1], atts[i]);
break;
}
if ((nsname != NULL) && (atts[j + 2] == nsname)) {
xmlNsErr(ctxt, XML_NS_ERR_ATTRIBUTE_REDEFINED,
"Namespaced Attribute %s in '%s' redefined\n",
atts[i], nsname, NULL);
break;
}
}
}
}
nsname = xmlGetNamespace(ctxt, prefix);
if ((prefix != NULL) && (nsname == NULL)) {
xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
"Namespace prefix %s on %s is not defined\n",
prefix, localname, NULL);
}
*pref = prefix;
*URI = nsname;
/*
* SAX: Start of Element !
*/
if ((ctxt->sax != NULL) && (ctxt->sax->startElementNs != NULL) &&
(!ctxt->disableSAX)) {
if (nbNs > 0)
ctxt->sax->startElementNs(ctxt->userData, localname, prefix,
nsname, nbNs, &ctxt->nsTab[ctxt->nsNr - 2 * nbNs],
nbatts / 5, nbdef, atts);
else
ctxt->sax->startElementNs(ctxt->userData, localname, prefix,
nsname, 0, NULL, nbatts / 5, nbdef, atts);
}
/*
* Free up attribute allocated strings if needed
*/
if (attval != 0) {
for (i = 3,j = 0; j < nratts;i += 5,j++)
if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL))
xmlFree((xmlChar *) atts[i]);
}
return(localname);
base_changed:
/*
* the attribute strings are valid iif the base didn't changed
*/
if (attval != 0) {
for (i = 3,j = 0; j < nratts;i += 5,j++)
if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL))
xmlFree((xmlChar *) atts[i]);
}
ctxt->input->cur = ctxt->input->base + cur;
ctxt->input->line = oldline;
ctxt->input->col = oldcol;
if (ctxt->wellFormed == 1) {
goto reparse;
}
return(NULL);
}
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.