idx
int64 | func
string | target
int64 |
|---|---|---|
401,529
|
static void extract_crng(__u8 out[CHACHA_BLOCK_SIZE])
{
struct crng_state *crng = NULL;
#ifdef CONFIG_NUMA
if (crng_node_pool)
crng = crng_node_pool[numa_node_id()];
if (crng == NULL)
#endif
crng = &primary_crng;
_extract_crng(crng, out);
}
| 0
|
343,151
|
static struct ip_esp_hdr *esp_output_tcp_encap(struct xfrm_state *x,
struct sk_buff *skb,
struct esp_info *esp)
{
return ERR_PTR(-EOPNOTSUPP);
}
| 0
|
242,647
|
GF_Err isoffin_initialize(GF_Filter *filter)
{
ISOMReader *read = gf_filter_get_udta(filter);
GF_Err e = GF_OK;
read->filter = filter;
read->channels = gf_list_new();
if (read->xps_check==MP4DMX_XPS_AUTO) {
read->xps_check = (read->smode==MP4DMX_SPLIT_EXTRACTORS) ? MP4DMX_XPS_KEEP : MP4DMX_XPS_REMOVE;
}
if (read->src) {
read->input_loaded = GF_TRUE;
return isoffin_setup(filter, read);
}
else if (read->mov) {
read->extern_mov = GF_TRUE;
read->input_loaded = GF_TRUE;
read->frag_type = gf_isom_is_fragmented(read->mov) ? 1 : 0;
read->timescale = gf_isom_get_timescale(read->mov);
if (read->sigfrag) {
gf_isom_enable_traf_map_templates(read->mov);
}
if (read->catseg) {
e = gf_isom_open_segment(read->mov, read->catseg, 0, 0, 0);
}
if (!e)
e = isor_declare_objects(read);
gf_filter_post_process_task(filter);
}
return e;
}
| 0
|
294,514
|
datetime_s_weeknum(int argc, VALUE *argv, VALUE klass)
{
VALUE vy, vw, vd, vf, vh, vmin, vs, vof, vsg, y, fr, fr2, ret;
int w, d, f, h, min, s, rof;
double sg;
rb_scan_args(argc, argv, "09", &vy, &vw, &vd, &vf,
&vh, &vmin, &vs, &vof, &vsg);
y = INT2FIX(-4712);
w = 0;
d = 1;
f = 0;
h = min = s = 0;
fr2 = INT2FIX(0);
rof = 0;
sg = DEFAULT_SG;
switch (argc) {
case 9:
val2sg(vsg, sg);
case 8:
val2off(vof, rof);
case 7:
num2int_with_frac(s, positive_inf);
case 6:
num2int_with_frac(min, 6);
case 5:
num2int_with_frac(h, 5);
case 4:
f = NUM2INT(vf);
case 3:
num2int_with_frac(d, 4);
case 2:
w = NUM2INT(vw);
case 1:
y = vy;
}
{
VALUE nth;
int ry, rw, rd, rh, rmin, rs, rjd, rjd2, ns;
if (!valid_weeknum_p(y, w, d, f, sg,
&nth, &ry,
&rw, &rd, &rjd,
&ns))
rb_raise(eDateError, "invalid date");
if (!c_valid_time_p(h, min, s, &rh, &rmin, &rs))
rb_raise(eDateError, "invalid date");
canon24oc();
rjd2 = jd_local_to_utc(rjd,
time_to_df(rh, rmin, rs),
rof);
ret = d_complex_new_internal(klass,
nth, rjd2,
0, INT2FIX(0),
rof, sg,
0, 0, 0,
rh, rmin, rs,
HAVE_JD | HAVE_TIME);
}
add_frac();
return ret;
}
| 0
|
240,297
|
do_put(
int regname,
char_u *expr_result, // result for regname "=" when compiled
int dir, // BACKWARD for 'P', FORWARD for 'p'
long count,
int flags)
{
char_u *ptr;
char_u *newp, *oldp;
int yanklen;
int totlen = 0; // init for gcc
linenr_T lnum;
colnr_T col;
long i; // index in y_array[]
int y_type;
long y_size;
int oldlen;
long y_width = 0;
colnr_T vcol;
int delcount;
int incr = 0;
long j;
struct block_def bd;
char_u **y_array = NULL;
yankreg_T *y_current_used = NULL;
long nr_lines = 0;
pos_T new_cursor;
int indent;
int orig_indent = 0; // init for gcc
int indent_diff = 0; // init for gcc
int first_indent = TRUE;
int lendiff = 0;
pos_T old_pos;
char_u *insert_string = NULL;
int allocated = FALSE;
long cnt;
pos_T orig_start = curbuf->b_op_start;
pos_T orig_end = curbuf->b_op_end;
unsigned int cur_ve_flags = get_ve_flags();
#ifdef FEAT_CLIPBOARD
// Adjust register name for "unnamed" in 'clipboard'.
adjust_clip_reg(®name);
(void)may_get_selection(regname);
#endif
if (flags & PUT_FIXINDENT)
orig_indent = get_indent();
curbuf->b_op_start = curwin->w_cursor; // default for '[ mark
curbuf->b_op_end = curwin->w_cursor; // default for '] mark
// Using inserted text works differently, because the register includes
// special characters (newlines, etc.).
if (regname == '.')
{
if (VIsual_active)
stuffcharReadbuff(VIsual_mode);
(void)stuff_inserted((dir == FORWARD ? (count == -1 ? 'o' : 'a') :
(count == -1 ? 'O' : 'i')), count, FALSE);
// Putting the text is done later, so can't really move the cursor to
// the next character. Use "l" to simulate it.
if ((flags & PUT_CURSEND) && gchar_cursor() != NUL)
stuffcharReadbuff('l');
return;
}
// For special registers '%' (file name), '#' (alternate file name) and
// ':' (last command line), etc. we have to create a fake yank register.
// For compiled code "expr_result" holds the expression result.
if (regname == '=' && expr_result != NULL)
insert_string = expr_result;
else if (get_spec_reg(regname, &insert_string, &allocated, TRUE)
&& insert_string == NULL)
return;
// Autocommands may be executed when saving lines for undo. This might
// make "y_array" invalid, so we start undo now to avoid that.
if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL)
goto end;
if (insert_string != NULL)
{
y_type = MCHAR;
#ifdef FEAT_EVAL
if (regname == '=')
{
// For the = register we need to split the string at NL
// characters.
// Loop twice: count the number of lines and save them.
for (;;)
{
y_size = 0;
ptr = insert_string;
while (ptr != NULL)
{
if (y_array != NULL)
y_array[y_size] = ptr;
++y_size;
ptr = vim_strchr(ptr, '\n');
if (ptr != NULL)
{
if (y_array != NULL)
*ptr = NUL;
++ptr;
// A trailing '\n' makes the register linewise.
if (*ptr == NUL)
{
y_type = MLINE;
break;
}
}
}
if (y_array != NULL)
break;
y_array = ALLOC_MULT(char_u *, y_size);
if (y_array == NULL)
goto end;
}
}
else
#endif
{
y_size = 1; // use fake one-line yank register
y_array = &insert_string;
}
}
else
{
get_yank_register(regname, FALSE);
y_type = y_current->y_type;
y_width = y_current->y_width;
y_size = y_current->y_size;
y_array = y_current->y_array;
y_current_used = y_current;
}
if (y_type == MLINE)
{
if (flags & PUT_LINE_SPLIT)
{
char_u *p;
// "p" or "P" in Visual mode: split the lines to put the text in
// between.
if (u_save_cursor() == FAIL)
goto end;
p = ml_get_cursor();
if (dir == FORWARD && *p != NUL)
MB_PTR_ADV(p);
ptr = vim_strsave(p);
if (ptr == NULL)
goto end;
ml_append(curwin->w_cursor.lnum, ptr, (colnr_T)0, FALSE);
vim_free(ptr);
oldp = ml_get_curline();
p = oldp + curwin->w_cursor.col;
if (dir == FORWARD && *p != NUL)
MB_PTR_ADV(p);
ptr = vim_strnsave(oldp, p - oldp);
if (ptr == NULL)
goto end;
ml_replace(curwin->w_cursor.lnum, ptr, FALSE);
++nr_lines;
dir = FORWARD;
}
if (flags & PUT_LINE_FORWARD)
{
// Must be "p" for a Visual block, put lines below the block.
curwin->w_cursor = curbuf->b_visual.vi_end;
dir = FORWARD;
}
curbuf->b_op_start = curwin->w_cursor; // default for '[ mark
curbuf->b_op_end = curwin->w_cursor; // default for '] mark
}
if (flags & PUT_LINE) // :put command or "p" in Visual line mode.
y_type = MLINE;
if (y_size == 0 || y_array == NULL)
{
semsg(_(e_nothing_in_register_str),
regname == 0 ? (char_u *)"\"" : transchar(regname));
goto end;
}
if (y_type == MBLOCK)
{
lnum = curwin->w_cursor.lnum + y_size + 1;
if (lnum > curbuf->b_ml.ml_line_count)
lnum = curbuf->b_ml.ml_line_count + 1;
if (u_save(curwin->w_cursor.lnum - 1, lnum) == FAIL)
goto end;
}
else if (y_type == MLINE)
{
lnum = curwin->w_cursor.lnum;
#ifdef FEAT_FOLDING
// Correct line number for closed fold. Don't move the cursor yet,
// u_save() uses it.
if (dir == BACKWARD)
(void)hasFolding(lnum, &lnum, NULL);
else
(void)hasFolding(lnum, NULL, &lnum);
#endif
if (dir == FORWARD)
++lnum;
// In an empty buffer the empty line is going to be replaced, include
// it in the saved lines.
if ((BUFEMPTY() ? u_save(0, 2) : u_save(lnum - 1, lnum)) == FAIL)
goto end;
#ifdef FEAT_FOLDING
if (dir == FORWARD)
curwin->w_cursor.lnum = lnum - 1;
else
curwin->w_cursor.lnum = lnum;
curbuf->b_op_start = curwin->w_cursor; // for mark_adjust()
#endif
}
else if (u_save_cursor() == FAIL)
goto end;
yanklen = (int)STRLEN(y_array[0]);
if (cur_ve_flags == VE_ALL && y_type == MCHAR)
{
if (gchar_cursor() == TAB)
{
int viscol = getviscol();
int ts = curbuf->b_p_ts;
// Don't need to insert spaces when "p" on the last position of a
// tab or "P" on the first position.
if (dir == FORWARD ?
#ifdef FEAT_VARTABS
tabstop_padding(viscol, ts, curbuf->b_p_vts_array) != 1
#else
ts - (viscol % ts) != 1
#endif
: curwin->w_cursor.coladd > 0)
coladvance_force(viscol);
else
curwin->w_cursor.coladd = 0;
}
else if (curwin->w_cursor.coladd > 0 || gchar_cursor() == NUL)
coladvance_force(getviscol() + (dir == FORWARD));
}
lnum = curwin->w_cursor.lnum;
col = curwin->w_cursor.col;
// Block mode
if (y_type == MBLOCK)
{
int c = gchar_cursor();
colnr_T endcol2 = 0;
if (dir == FORWARD && c != NUL)
{
if (cur_ve_flags == VE_ALL)
getvcol(curwin, &curwin->w_cursor, &col, NULL, &endcol2);
else
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
if (has_mbyte)
// move to start of next multi-byte character
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
else
if (c != TAB || cur_ve_flags != VE_ALL)
++curwin->w_cursor.col;
++col;
}
else
getvcol(curwin, &curwin->w_cursor, &col, NULL, &endcol2);
col += curwin->w_cursor.coladd;
if (cur_ve_flags == VE_ALL
&& (curwin->w_cursor.coladd > 0
|| endcol2 == curwin->w_cursor.col))
{
if (dir == FORWARD && c == NUL)
++col;
if (dir != FORWARD && c != NUL && curwin->w_cursor.coladd > 0)
++curwin->w_cursor.col;
if (c == TAB)
{
if (dir == BACKWARD && curwin->w_cursor.col)
curwin->w_cursor.col--;
if (dir == FORWARD && col - 1 == endcol2)
curwin->w_cursor.col++;
}
}
curwin->w_cursor.coladd = 0;
bd.textcol = 0;
for (i = 0; i < y_size; ++i)
{
int spaces = 0;
char shortline;
bd.startspaces = 0;
bd.endspaces = 0;
vcol = 0;
delcount = 0;
// add a new line
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
{
if (ml_append(curbuf->b_ml.ml_line_count, (char_u *)"",
(colnr_T)1, FALSE) == FAIL)
break;
++nr_lines;
}
// get the old line and advance to the position to insert at
oldp = ml_get_curline();
oldlen = (int)STRLEN(oldp);
for (ptr = oldp; vcol < col && *ptr; )
{
// Count a tab for what it's worth (if list mode not on)
incr = lbr_chartabsize_adv(oldp, &ptr, (colnr_T)vcol);
vcol += incr;
}
bd.textcol = (colnr_T)(ptr - oldp);
shortline = (vcol < col) || (vcol == col && !*ptr) ;
if (vcol < col) // line too short, padd with spaces
bd.startspaces = col - vcol;
else if (vcol > col)
{
bd.endspaces = vcol - col;
bd.startspaces = incr - bd.endspaces;
--bd.textcol;
delcount = 1;
if (has_mbyte)
bd.textcol -= (*mb_head_off)(oldp, oldp + bd.textcol);
if (oldp[bd.textcol] != TAB)
{
// Only a Tab can be split into spaces. Other
// characters will have to be moved to after the
// block, causing misalignment.
delcount = 0;
bd.endspaces = 0;
}
}
yanklen = (int)STRLEN(y_array[i]);
if ((flags & PUT_BLOCK_INNER) == 0)
{
// calculate number of spaces required to fill right side of
// block
spaces = y_width + 1;
for (j = 0; j < yanklen; j++)
spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
if (spaces < 0)
spaces = 0;
}
// Insert the new text.
// First check for multiplication overflow.
if (yanklen + spaces != 0
&& count > ((INT_MAX - (bd.startspaces + bd.endspaces))
/ (yanklen + spaces)))
{
emsg(_(e_resulting_text_too_long));
break;
}
totlen = count * (yanklen + spaces) + bd.startspaces + bd.endspaces;
newp = alloc(totlen + oldlen + 1);
if (newp == NULL)
break;
// copy part up to cursor to new line
ptr = newp;
mch_memmove(ptr, oldp, (size_t)bd.textcol);
ptr += bd.textcol;
// may insert some spaces before the new text
vim_memset(ptr, ' ', (size_t)bd.startspaces);
ptr += bd.startspaces;
// insert the new text
for (j = 0; j < count; ++j)
{
mch_memmove(ptr, y_array[i], (size_t)yanklen);
ptr += yanklen;
// insert block's trailing spaces only if there's text behind
if ((j < count - 1 || !shortline) && spaces)
{
vim_memset(ptr, ' ', (size_t)spaces);
ptr += spaces;
}
}
// may insert some spaces after the new text
vim_memset(ptr, ' ', (size_t)bd.endspaces);
ptr += bd.endspaces;
// move the text after the cursor to the end of the line.
mch_memmove(ptr, oldp + bd.textcol + delcount,
(size_t)(oldlen - bd.textcol - delcount + 1));
ml_replace(curwin->w_cursor.lnum, newp, FALSE);
++curwin->w_cursor.lnum;
if (i == 0)
curwin->w_cursor.col += bd.startspaces;
}
changed_lines(lnum, 0, curwin->w_cursor.lnum, nr_lines);
// Set '[ mark.
curbuf->b_op_start = curwin->w_cursor;
curbuf->b_op_start.lnum = lnum;
// adjust '] mark
curbuf->b_op_end.lnum = curwin->w_cursor.lnum - 1;
curbuf->b_op_end.col = bd.textcol + totlen - 1;
curbuf->b_op_end.coladd = 0;
if (flags & PUT_CURSEND)
{
colnr_T len;
curwin->w_cursor = curbuf->b_op_end;
curwin->w_cursor.col++;
// in Insert mode we might be after the NUL, correct for that
len = (colnr_T)STRLEN(ml_get_curline());
if (curwin->w_cursor.col > len)
curwin->w_cursor.col = len;
}
else
curwin->w_cursor.lnum = lnum;
}
else
{
// Character or Line mode
if (y_type == MCHAR)
{
// if type is MCHAR, FORWARD is the same as BACKWARD on the next
// char
if (dir == FORWARD && gchar_cursor() != NUL)
{
if (has_mbyte)
{
int bytelen = (*mb_ptr2len)(ml_get_cursor());
// put it on the next of the multi-byte character.
col += bytelen;
if (yanklen)
{
curwin->w_cursor.col += bytelen;
curbuf->b_op_end.col += bytelen;
}
}
else
{
++col;
if (yanklen)
{
++curwin->w_cursor.col;
++curbuf->b_op_end.col;
}
}
}
curbuf->b_op_start = curwin->w_cursor;
}
// Line mode: BACKWARD is the same as FORWARD on the previous line
else if (dir == BACKWARD)
--lnum;
new_cursor = curwin->w_cursor;
// simple case: insert into one line at a time
if (y_type == MCHAR && y_size == 1)
{
linenr_T end_lnum = 0; // init for gcc
linenr_T start_lnum = lnum;
int first_byte_off = 0;
if (VIsual_active)
{
end_lnum = curbuf->b_visual.vi_end.lnum;
if (end_lnum < curbuf->b_visual.vi_start.lnum)
end_lnum = curbuf->b_visual.vi_start.lnum;
if (end_lnum > start_lnum)
{
pos_T pos;
// "col" is valid for the first line, in following lines
// the virtual column needs to be used. Matters for
// multi-byte characters.
pos.lnum = lnum;
pos.col = col;
pos.coladd = 0;
getvcol(curwin, &pos, NULL, &vcol, NULL);
}
}
if (count == 0 || yanklen == 0)
{
if (VIsual_active)
lnum = end_lnum;
}
else if (count > INT_MAX / yanklen)
// multiplication overflow
emsg(_(e_resulting_text_too_long));
else
{
totlen = count * yanklen;
do {
oldp = ml_get(lnum);
oldlen = (int)STRLEN(oldp);
if (lnum > start_lnum)
{
pos_T pos;
pos.lnum = lnum;
if (getvpos(&pos, vcol) == OK)
col = pos.col;
else
col = MAXCOL;
}
if (VIsual_active && col > oldlen)
{
lnum++;
continue;
}
newp = alloc(totlen + oldlen + 1);
if (newp == NULL)
goto end; // alloc() gave an error message
mch_memmove(newp, oldp, (size_t)col);
ptr = newp + col;
for (i = 0; i < count; ++i)
{
mch_memmove(ptr, y_array[0], (size_t)yanklen);
ptr += yanklen;
}
STRMOVE(ptr, oldp + col);
ml_replace(lnum, newp, FALSE);
// compute the byte offset for the last character
first_byte_off = mb_head_off(newp, ptr - 1);
// Place cursor on last putted char.
if (lnum == curwin->w_cursor.lnum)
{
// make sure curwin->w_virtcol is updated
changed_cline_bef_curs();
curwin->w_cursor.col += (colnr_T)(totlen - 1);
}
if (VIsual_active)
lnum++;
} while (VIsual_active && lnum <= end_lnum);
if (VIsual_active) // reset lnum to the last visual line
lnum--;
}
// put '] at the first byte of the last character
curbuf->b_op_end = curwin->w_cursor;
curbuf->b_op_end.col -= first_byte_off;
// For "CTRL-O p" in Insert mode, put cursor after last char
if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND)))
++curwin->w_cursor.col;
else
curwin->w_cursor.col -= first_byte_off;
changed_bytes(lnum, col);
}
else
{
linenr_T new_lnum = new_cursor.lnum;
size_t len;
// Insert at least one line. When y_type is MCHAR, break the first
// line in two.
for (cnt = 1; cnt <= count; ++cnt)
{
i = 0;
if (y_type == MCHAR)
{
// Split the current line in two at the insert position.
// First insert y_array[size - 1] in front of second line.
// Then append y_array[0] to first line.
lnum = new_cursor.lnum;
ptr = ml_get(lnum) + col;
totlen = (int)STRLEN(y_array[y_size - 1]);
newp = alloc(STRLEN(ptr) + totlen + 1);
if (newp == NULL)
goto error;
STRCPY(newp, y_array[y_size - 1]);
STRCAT(newp, ptr);
// insert second line
ml_append(lnum, newp, (colnr_T)0, FALSE);
++new_lnum;
vim_free(newp);
oldp = ml_get(lnum);
newp = alloc(col + yanklen + 1);
if (newp == NULL)
goto error;
// copy first part of line
mch_memmove(newp, oldp, (size_t)col);
// append to first line
mch_memmove(newp + col, y_array[0], (size_t)(yanklen + 1));
ml_replace(lnum, newp, FALSE);
curwin->w_cursor.lnum = lnum;
i = 1;
}
for (; i < y_size; ++i)
{
if (y_type != MCHAR || i < y_size - 1)
{
if (ml_append(lnum, y_array[i], (colnr_T)0, FALSE)
== FAIL)
goto error;
new_lnum++;
}
lnum++;
++nr_lines;
if (flags & PUT_FIXINDENT)
{
old_pos = curwin->w_cursor;
curwin->w_cursor.lnum = lnum;
ptr = ml_get(lnum);
if (cnt == count && i == y_size - 1)
lendiff = (int)STRLEN(ptr);
#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
if (*ptr == '#' && preprocs_left())
indent = 0; // Leave # lines at start
else
#endif
if (*ptr == NUL)
indent = 0; // Ignore empty lines
else if (first_indent)
{
indent_diff = orig_indent - get_indent();
indent = orig_indent;
first_indent = FALSE;
}
else if ((indent = get_indent() + indent_diff) < 0)
indent = 0;
(void)set_indent(indent, 0);
curwin->w_cursor = old_pos;
// remember how many chars were removed
if (cnt == count && i == y_size - 1)
lendiff -= (int)STRLEN(ml_get(lnum));
}
}
if (cnt == 1)
new_lnum = lnum;
}
error:
// Adjust marks.
if (y_type == MLINE)
{
curbuf->b_op_start.col = 0;
if (dir == FORWARD)
curbuf->b_op_start.lnum++;
}
// Skip mark_adjust when adding lines after the last one, there
// can't be marks there. But still needed in diff mode.
if (curbuf->b_op_start.lnum + (y_type == MCHAR) - 1 + nr_lines
< curbuf->b_ml.ml_line_count
#ifdef FEAT_DIFF
|| curwin->w_p_diff
#endif
)
mark_adjust(curbuf->b_op_start.lnum + (y_type == MCHAR),
(linenr_T)MAXLNUM, nr_lines, 0L);
// note changed text for displaying and folding
if (y_type == MCHAR)
changed_lines(curwin->w_cursor.lnum, col,
curwin->w_cursor.lnum + 1, nr_lines);
else
changed_lines(curbuf->b_op_start.lnum, 0,
curbuf->b_op_start.lnum, nr_lines);
if (y_current_used != NULL && (y_current_used != y_current
|| y_current->y_array != y_array))
{
// Something invoked through changed_lines() has changed the
// yank buffer, e.g. a GUI clipboard callback.
emsg(_(e_yank_register_changed_while_using_it));
goto end;
}
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.
curbuf->b_op_end.lnum = new_lnum;
len = STRLEN(y_array[y_size - 1]);
col = (colnr_T)len - lendiff;
if (col > 1)
curbuf->b_op_end.col = col - 1
- mb_head_off(y_array[y_size - 1],
y_array[y_size - 1] + len - 1);
else
curbuf->b_op_end.col = 0;
if (flags & PUT_CURSLINE)
{
// ":put": put cursor on last inserted line
curwin->w_cursor.lnum = lnum;
beginline(BL_WHITE | BL_FIX);
}
else if (flags & PUT_CURSEND)
{
// put cursor after inserted text
if (y_type == MLINE)
{
if (lnum >= curbuf->b_ml.ml_line_count)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
else
curwin->w_cursor.lnum = lnum + 1;
curwin->w_cursor.col = 0;
}
else
{
curwin->w_cursor.lnum = new_lnum;
curwin->w_cursor.col = col;
curbuf->b_op_end = curwin->w_cursor;
if (col > 1)
curbuf->b_op_end.col = col - 1;
}
}
else if (y_type == MLINE)
{
// put cursor on first non-blank in first inserted line
curwin->w_cursor.col = 0;
if (dir == FORWARD)
++curwin->w_cursor.lnum;
beginline(BL_WHITE | BL_FIX);
}
else // put cursor on first inserted character
curwin->w_cursor = new_cursor;
}
}
msgmore(nr_lines);
curwin->w_set_curswant = TRUE;
end:
if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
}
if (allocated)
vim_free(insert_string);
if (regname == '=')
vim_free(y_array);
VIsual_active = FALSE;
// If the cursor is past the end of the line put it at the end.
adjust_cursor_eol();
}
| 0
|
466,187
|
static int em_imul_ex(struct x86_emulate_ctxt *ctxt)
{
u8 ex = 0;
emulate_1op_rax_rdx(ctxt, "imul", ex);
return X86EMUL_CONTINUE;
}
| 0
|
463,153
|
static int annotation_set_tofile(annotate_state_t *state
__attribute__((unused)),
struct annotate_entry_list *entry,
int maywrite)
{
const char *filename = (const char *)entry->desc->rock;
char path[MAX_MAILBOX_PATH+1];
int r;
FILE *f;
if (!maywrite) return IMAP_PERMISSION_DENIED;
snprintf(path, sizeof(path), "%s/msg/%s", config_dir, filename);
/* XXX how do we do this atomically with other annotations? */
if (entry->shared.s == NULL)
return unlink(path);
else {
r = cyrus_mkdir(path, 0755);
if (r)
return r;
f = fopen(path, "w");
if (!f) {
syslog(LOG_ERR, "cannot open %s for writing: %m", path);
return IMAP_IOERROR;
}
fwrite(entry->shared.s, 1, entry->shared.len, f);
fputc('\n', f);
return fclose(f);
}
return IMAP_IOERROR;
}
| 0
|
272,367
|
unescape_html_in_place(char *s)
{
size_t sz = strlen(s) + 1;
size_t pos = 0;
char *s1;
dprintf("unescaping pos:%zd sz:%zd \"%s\"", pos, sz, s);
do {
s1 = strchrnul(&s[pos], '%');
if (s1[0] == '\0')
break;
dprintf("s1 is \"%s\"", s1);
if ((size_t)(s1 - s) < (size_t)(sz - 3)) {
int c;
c = (hexchar_to_bin(s1[1]) << 4)
| (hexchar_to_bin(s1[2]) & 0xf);
dprintf("replacing %%%c%c with 0x%02hhx", s1[1], s1[2], (char)c);
s1[0] = c;
memmove(&s1[1], &s1[3], sz - (&s1[3] - s));
sz -= 2;
pos = &s1[1] - s;
dprintf("new pos:%zd sz:%zd s:\"%s\"", pos, sz, s);
}
} while (pos < sz);
}
| 0
|
90,744
|
bool AddCallback(GetUsageAndQuotaCallback* callback, bool unlimited) {
if (unlimited)
unlimited_callbacks_.push_back(callback);
else
callbacks_.push_back(callback);
return (callbacks_.size() + unlimited_callbacks_.size() == 1);
}
| 0
|
226,373
|
GF_Err moof_box_write(GF_Box *s, GF_BitStream *bs)
{
return gf_isom_box_write_header(s, bs);
}
| 0
|
241,366
|
explicit MatrixSolveOpGpu(OpKernelConstruction* context)
: AsyncOpKernel(context) {
OP_REQUIRES_OK(context, context->GetAttr("adjoint", &adjoint_));
}
| 0
|
380,949
|
ins_tab(void)
{
int ind;
int i;
int temp;
if (Insstart_blank_vcol == MAXCOL && curwin->w_cursor.lnum == Insstart.lnum)
Insstart_blank_vcol = get_nolist_virtcol();
if (echeck_abbr(TAB + ABBR_OFF))
return FALSE;
ind = inindent(0);
if (ind)
can_cindent = FALSE;
/*
* When nothing special, insert TAB like a normal character.
*/
if (!curbuf->b_p_et
#ifdef FEAT_VARTABS
&& !(p_sta && ind
// These five lines mean 'tabstop' != 'shiftwidth'
&& ((tabstop_count(curbuf->b_p_vts_array) > 1)
|| (tabstop_count(curbuf->b_p_vts_array) == 1
&& tabstop_first(curbuf->b_p_vts_array)
!= get_sw_value(curbuf))
|| (tabstop_count(curbuf->b_p_vts_array) == 0
&& curbuf->b_p_ts != get_sw_value(curbuf))))
&& tabstop_count(curbuf->b_p_vsts_array) == 0
#else
&& !(p_sta && ind && curbuf->b_p_ts != get_sw_value(curbuf))
#endif
&& get_sts_value() == 0)
return TRUE;
if (stop_arrow() == FAIL)
return TRUE;
did_ai = FALSE;
did_si = FALSE;
can_si = FALSE;
can_si_back = FALSE;
AppendToRedobuff((char_u *)"\t");
#ifdef FEAT_VARTABS
if (p_sta && ind) // insert tab in indent, use 'shiftwidth'
{
temp = (int)get_sw_value(curbuf);
temp -= get_nolist_virtcol() % temp;
}
else if (tabstop_count(curbuf->b_p_vsts_array) > 0 || curbuf->b_p_sts != 0)
// use 'softtabstop' when set
temp = tabstop_padding(get_nolist_virtcol(), get_sts_value(),
curbuf->b_p_vsts_array);
else // otherwise use 'tabstop'
temp = tabstop_padding(get_nolist_virtcol(), curbuf->b_p_ts,
curbuf->b_p_vts_array);
#else
if (p_sta && ind) // insert tab in indent, use 'shiftwidth'
temp = (int)get_sw_value(curbuf);
else if (curbuf->b_p_sts != 0) // use 'softtabstop' when set
temp = (int)get_sts_value();
else // otherwise use 'tabstop'
temp = (int)curbuf->b_p_ts;
temp -= get_nolist_virtcol() % temp;
#endif
/*
* Insert the first space with ins_char(). It will delete one char in
* replace mode. Insert the rest with ins_str(); it will not delete any
* chars. For MODE_VREPLACE state, we use ins_char() for all characters.
*/
ins_char(' ');
while (--temp > 0)
{
if (State & VREPLACE_FLAG)
ins_char(' ');
else
{
ins_str((char_u *)" ");
if (State & REPLACE_FLAG) // no char replaced
replace_push(NUL);
}
}
/*
* When 'expandtab' not set: Replace spaces by TABs where possible.
*/
#ifdef FEAT_VARTABS
if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0
|| get_sts_value() > 0
|| (p_sta && ind)))
#else
if (!curbuf->b_p_et && (get_sts_value() || (p_sta && ind)))
#endif
{
char_u *ptr;
char_u *saved_line = NULL; // init for GCC
pos_T pos;
pos_T fpos;
pos_T *cursor;
colnr_T want_vcol, vcol;
int change_col = -1;
int save_list = curwin->w_p_list;
/*
* Get the current line. For MODE_VREPLACE state, don't make real
* changes yet, just work on a copy of the line.
*/
if (State & VREPLACE_FLAG)
{
pos = curwin->w_cursor;
cursor = &pos;
saved_line = vim_strsave(ml_get_curline());
if (saved_line == NULL)
return FALSE;
ptr = saved_line + pos.col;
}
else
{
ptr = ml_get_cursor();
cursor = &curwin->w_cursor;
}
// When 'L' is not in 'cpoptions' a tab always takes up 'ts' spaces.
if (vim_strchr(p_cpo, CPO_LISTWM) == NULL)
curwin->w_p_list = FALSE;
// Find first white before the cursor
fpos = curwin->w_cursor;
while (fpos.col > 0 && VIM_ISWHITE(ptr[-1]))
{
--fpos.col;
--ptr;
}
// In Replace mode, don't change characters before the insert point.
if ((State & REPLACE_FLAG)
&& fpos.lnum == Insstart.lnum
&& fpos.col < Insstart.col)
{
ptr += Insstart.col - fpos.col;
fpos.col = Insstart.col;
}
// compute virtual column numbers of first white and cursor
getvcol(curwin, &fpos, &vcol, NULL, NULL);
getvcol(curwin, cursor, &want_vcol, NULL, NULL);
// Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
// and 'linebreak' adding extra virtual columns.
while (VIM_ISWHITE(*ptr))
{
i = lbr_chartabsize(NULL, (char_u *)"\t", vcol);
if (vcol + i > want_vcol)
break;
if (*ptr != TAB)
{
*ptr = TAB;
if (change_col < 0)
{
change_col = fpos.col; // Column of first change
// May have to adjust Insstart
if (fpos.lnum == Insstart.lnum && fpos.col < Insstart.col)
Insstart.col = fpos.col;
}
}
++fpos.col;
++ptr;
vcol += i;
}
if (change_col >= 0)
{
int repl_off = 0;
char_u *line = ptr;
// Skip over the spaces we need.
while (vcol < want_vcol && *ptr == ' ')
{
vcol += lbr_chartabsize(line, ptr, vcol);
++ptr;
++repl_off;
}
if (vcol > want_vcol)
{
// Must have a char with 'showbreak' just before it.
--ptr;
--repl_off;
}
fpos.col += repl_off;
// Delete following spaces.
i = cursor->col - fpos.col;
if (i > 0)
{
#ifdef FEAT_PROP_POPUP
if (!(State & VREPLACE_FLAG))
{
char_u *newp;
int col;
newp = alloc(curbuf->b_ml.ml_line_len - i);
if (newp == NULL)
return FALSE;
col = ptr - curbuf->b_ml.ml_line_ptr;
if (col > 0)
mch_memmove(newp, ptr - col, col);
mch_memmove(newp + col, ptr + i,
curbuf->b_ml.ml_line_len - col - i);
if (curbuf->b_ml.ml_flags & ML_LINE_DIRTY)
vim_free(curbuf->b_ml.ml_line_ptr);
curbuf->b_ml.ml_line_ptr = newp;
curbuf->b_ml.ml_line_len -= i;
curbuf->b_ml.ml_flags =
(curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
}
else
#endif
STRMOVE(ptr, ptr + i);
// correct replace stack.
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
for (temp = i; --temp >= 0; )
replace_join(repl_off);
}
#ifdef FEAT_NETBEANS_INTG
if (netbeans_active())
{
netbeans_removed(curbuf, fpos.lnum, cursor->col, (long)(i + 1));
netbeans_inserted(curbuf, fpos.lnum, cursor->col,
(char_u *)"\t", 1);
}
#endif
cursor->col -= i;
/*
* In MODE_VREPLACE state, we haven't changed anything yet. Do it
* now by backspacing over the changed spacing and then inserting
* the new spacing.
*/
if (State & VREPLACE_FLAG)
{
// Backspace from real cursor to change_col
backspace_until_column(change_col);
// Insert each char in saved_line from changed_col to
// ptr-cursor
ins_bytes_len(saved_line + change_col,
cursor->col - change_col);
}
}
if (State & VREPLACE_FLAG)
vim_free(saved_line);
curwin->w_p_list = save_list;
}
return FALSE;
}
| 0
|
346,451
|
may_prefix_autoload(char_u *name)
{
if (SCRIPT_ID_VALID(current_sctx.sc_sid))
{
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
if (si->sn_autoload_prefix != NULL)
{
char_u *basename = name;
size_t len;
char_u *res;
if (*name == K_SPECIAL)
{
char_u *p = vim_strchr(name, '_');
// skip over "<SNR>99_"
if (p != NULL)
basename = p + 1;
}
len = STRLEN(si->sn_autoload_prefix) + STRLEN(basename) + 2;
res = alloc(len);
if (res != NULL)
{
vim_snprintf((char *)res, len, "%s%s",
si->sn_autoload_prefix, basename);
return res;
}
}
}
return name;
}
| 0
|
512,243
|
Item_cache_datetime(THD *thd)
:Item_cache_temporal(thd, &type_handler_datetime2) { }
| 0
|
517,429
|
static void print_service_rules_socket(HttpResponse res, Service_T s) {
for (Port_T p = s->socketlist; p; p = p->next) {
StringBuffer_append(res->outputbuffer, "<tr class='rule'><td>Unix Socket</td><td>");
if (p->retry > 1)
Util_printRule(res->outputbuffer, p->action, "If failed %s type %s protocol %s with timeout %s and retry %d time(s)", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){}), p->retry);
else
Util_printRule(res->outputbuffer, p->action, "If failed %s type %s protocol %s with timeout %s", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){}));
StringBuffer_append(res->outputbuffer, "</td></tr>");
}
}
| 0
|
412,109
|
dnsc_nonces_lookup(struct slabhash* cache,
const uint8_t nonce[crypto_box_HALF_NONCEBYTES],
const uint8_t magic_query[DNSCRYPT_MAGIC_HEADER_LEN],
const uint8_t pk[crypto_box_PUBLICKEYBYTES],
uint32_t hash)
{
struct nonce_cache_key k;
memset(&k, 0, sizeof(k));
k.entry.hash = hash;
memcpy(k.nonce, nonce, crypto_box_HALF_NONCEBYTES);
memcpy(k.magic_query, magic_query, DNSCRYPT_MAGIC_HEADER_LEN);
memcpy(k.client_publickey, pk, crypto_box_PUBLICKEYBYTES);
return slabhash_lookup(cache, hash, &k, 0);
}
| 0
|
448,921
|
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
z_streamp strm;
Bytef *dictionary;
uInt *dictLength;
{
struct inflate_state FAR *state;
/* check state */
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
/* copy dictionary */
if (state->whave && dictionary != Z_NULL) {
zmemcpy(dictionary, state->window + state->wnext,
state->whave - state->wnext);
zmemcpy(dictionary + state->whave - state->wnext,
state->window, state->wnext);
}
if (dictLength != Z_NULL)
*dictLength = state->whave;
return Z_OK;
}
| 0
|
240,278
|
free_register(void *reg)
{
yankreg_T tmp;
tmp = *y_current;
*y_current = *(yankreg_T *)reg;
free_yank_all();
vim_free(reg);
*y_current = tmp;
}
| 0
|
229,253
|
std::unique_ptr<cql_server::response> cql_server::connection::make_supported(int16_t stream, const tracing::trace_state_ptr& tr_state) const
{
std::multimap<sstring, sstring> opts;
opts.insert({"CQL_VERSION", cql3::query_processor::CQL_VERSION});
opts.insert({"COMPRESSION", "lz4"});
opts.insert({"COMPRESSION", "snappy"});
if (_server._config.allow_shard_aware_drivers) {
opts.insert({"SCYLLA_SHARD", format("{:d}", this_shard_id())});
opts.insert({"SCYLLA_NR_SHARDS", format("{:d}", smp::count)});
opts.insert({"SCYLLA_SHARDING_ALGORITHM", dht::cpu_sharding_algorithm_name()});
if (_server._config.shard_aware_transport_port) {
opts.insert({"SCYLLA_SHARD_AWARE_PORT", format("{:d}", *_server._config.shard_aware_transport_port)});
}
if (_server._config.shard_aware_transport_port_ssl) {
opts.insert({"SCYLLA_SHARD_AWARE_PORT_SSL", format("{:d}", *_server._config.shard_aware_transport_port_ssl)});
}
opts.insert({"SCYLLA_SHARDING_IGNORE_MSB", format("{:d}", _server._config.sharding_ignore_msb)});
opts.insert({"SCYLLA_PARTITIONER", _server._config.partitioner_name});
}
for (cql_protocol_extension ext : supported_cql_protocol_extensions()) {
const sstring ext_key_name = protocol_extension_name(ext);
std::vector<sstring> params = additional_options_for_proto_ext(ext);
if (params.empty()) {
opts.emplace(ext_key_name, "");
} else {
for (sstring val : params) {
opts.emplace(ext_key_name, std::move(val));
}
}
}
auto response = std::make_unique<cql_server::response>(stream, cql_binary_opcode::SUPPORTED, tr_state);
response->write_string_multimap(std::move(opts));
return response;
}
| 0
|
310,142
|
_nc_use_tracef(unsigned mask)
{
bool result = FALSE;
_nc_lock_global(tst_tracef);
if (!MyNested++) {
if ((result = (_nc_tracing & (mask))) != 0
&& _nc_try_global(tracef) == 0) {
/* we will call _nc_locked_tracef(), no nesting so far */
} else {
/* we will not call _nc_locked_tracef() */
MyNested = 0;
}
} else {
/* we may call _nc_locked_tracef(), but with nested_tracef > 0 */
result = (_nc_tracing & (mask));
}
_nc_unlock_global(tst_tracef);
return result;
}
| 0
|
468,385
|
set_last_error (GSocketClientAsyncConnectData *data,
GError *error)
{
g_clear_error (&data->last_error);
data->last_error = error;
}
| 0
|
264,369
|
inline protobuf::RepeatedPtrField<string>* MutableTensorProtoData<tstring>(
TensorProto* t) {
static_assert(SaveTypeTraits<tstring>::supported,
"Specified type tstring not supported for Save");
return t->mutable_string_val();
}
| 0
|
508,779
|
static int rr_from_cache(READ_RECORD *info)
{
uint i;
ulong length;
my_off_t rest_of_file;
int16 error;
uchar *position,*ref_position,*record_pos;
ulong record;
for (;;)
{
if (info->cache_pos != info->cache_end)
{
if (info->cache_pos[info->error_offset])
{
shortget(error,info->cache_pos);
if (info->print_error)
info->table->file->print_error(error,MYF(0));
}
else
{
error=0;
memcpy(info->record,info->cache_pos,
(size_t) info->table->s->reclength);
}
info->cache_pos+=info->reclength;
return ((int) error);
}
length=info->rec_cache_size;
rest_of_file=info->io_cache->end_of_file - my_b_tell(info->io_cache);
if ((my_off_t) length > rest_of_file)
length= (ulong) rest_of_file;
if (!length || my_b_read(info->io_cache,info->cache,length))
{
DBUG_PRINT("info",("Found end of file"));
return -1; /* End of file */
}
length/=info->ref_length;
position=info->cache;
ref_position=info->read_positions;
for (i=0 ; i < length ; i++,position+=info->ref_length)
{
memcpy(ref_position,position,(size_t) info->ref_length);
ref_position+=MAX_REFLENGTH;
int3store(ref_position,(long) i);
ref_position+=3;
}
my_qsort(info->read_positions, length, info->struct_length,
(qsort_cmp) rr_cmp);
position=info->read_positions;
for (i=0 ; i < length ; i++)
{
memcpy(info->ref_pos,position,(size_t) info->ref_length);
position+=MAX_REFLENGTH;
record=uint3korr(position);
position+=3;
record_pos=info->cache+record*info->reclength;
if ((error=(int16) info->table->file->ha_rnd_pos(record_pos,info->ref_pos)))
{
record_pos[info->error_offset]=1;
shortstore(record_pos,error);
DBUG_PRINT("error",("Got error: %d:%d when reading row",
my_errno, error));
}
else
record_pos[info->error_offset]=0;
}
info->cache_end=(info->cache_pos=info->cache)+length*info->reclength;
}
} /* rr_from_cache */
| 0
|
224,741
|
void ipro_box_del(GF_Box *s)
{
GF_ItemProtectionBox *ptr = (GF_ItemProtectionBox *)s;
if (ptr == NULL) return;
gf_list_del(ptr->protection_information);
gf_free(ptr);
}
| 0
|
225,785
|
GF_Box *void_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_Box, GF_ISOM_BOX_TYPE_VOID);
return tmp;
| 0
|
219,003
|
bool ConstantFolding::MergeConcat(bool use_shape_info,
GraphProperties* properties,
GraphDef* optimized_graph, NodeDef* node) {
// We only optimize for ConcatV2.
int axis;
if (!use_shape_info || !GetConcatAxis(*node, &axis) ||
nodes_to_preserve_.find(node->name()) != nodes_to_preserve_.end() ||
node_map_->GetOutputs(node->name()).size() != 1) {
return false;
}
// If all inputs are constant, don't merge and let folding take case of it.
const int num_regular_inputs = NumNonControlInputs(*node);
bool all_inputs_are_const = true;
for (int i = 0; i < num_regular_inputs - 1; ++i) {
const NodeDef* input_node = node_map_->GetNode(node->input(i));
if (!IsReallyConstant(*input_node)) {
all_inputs_are_const = false;
break;
}
}
if (all_inputs_are_const) return false;
NodeDef* parent = *node_map_->GetOutputs(node->name()).begin();
int parent_axis;
if (!GetConcatAxis(*parent, &parent_axis) || axis != parent_axis) {
return false;
}
// Make a pass over the parent inputs to see if any of them have explicit
// device() fields set, and if different inputs are on different tasks. If
// so, this concat of concats may have been carefully constructed to be a
// two-stage concat, and we don't want to undo that here.
string task, device;
absl::flat_hash_set<string> unique_input_tasks;
const int n_parent_inputs = NumNonControlInputs(*parent);
// Iterate over the real inputs to concatenate [0..n_parent_inputs - 1). The
// input at n_parent_inputs - 1 is the concat axis argument for a ConcatV2
// node, which we don't want to consider here.
for (int i = 0; i < n_parent_inputs - 1; ++i) {
const NodeDef* input_node = node_map_->GetNode(parent->input(i));
if (!input_node->device().empty() &&
tensorflow::DeviceNameUtils::SplitDeviceName(input_node->device(),
&task, &device)) {
unique_input_tasks.insert(task);
if (unique_input_tasks.size() >= 2) {
// More than one input task represented in the device specifications
// of the parent's input nodes. Don't mess with this.
return false;
}
}
}
protobuf::RepeatedPtrField<string> parent_inputs;
parent_inputs.Swap(parent->mutable_input());
// TODO(rmlarsen): IF the child occurs more than once, is it beneficial to
// collapse it into the parent multiple times? Probably not.
for (const auto& input : parent_inputs) {
if (IsSameInput(input, node->name())) {
for (int j = 0; j < num_regular_inputs - 1; ++j) {
// Add tensor inputs to first child concat tensors (except the final
// axis input) to the parent's inputs.
parent->add_input(node->input(j));
node_map_->UpdateInput(parent->name(), node->name(), node->input(j));
}
} else {
parent->add_input(input);
}
}
// Forward Add control inputs
const int num_inputs = node->input_size();
for (int i = num_inputs - 1; i >= num_regular_inputs; --i) {
parent->add_input(node->input(i));
node_map_->UpdateInput(parent->name(), node->name(), node->input(i));
node->mutable_input()->RemoveLast();
}
(*parent->mutable_attr())["N"].set_i(NumNonControlInputs(*parent) - 1);
DedupControlInputs(parent);
ReplaceOperationWithNoOp(node, properties, optimized_graph);
return true;
}
| 0
|
462,581
|
controller::controller() : v(0), urlcfg(0), rsscache(0), url_file("urls"), cache_file("cache.db"), config_file("config"), queue_file("queue"), refresh_on_start(false), api(0) {
}
| 0
|
207,780
|
static RList *create_cache_bins(RBinFile *bf, RDyldCache *cache) {
RList *bins = r_list_newf ((RListFree)free_bin);
ut16 *depArray = NULL;
cache_imgxtr_t *extras = NULL;
if (!bins) {
return NULL;
}
char *target_libs = NULL;
RList *target_lib_names = NULL;
int *deps = NULL;
target_libs = r_sys_getenv ("R_DYLDCACHE_FILTER");
if (target_libs) {
target_lib_names = r_str_split_list (target_libs, ":", 0);
if (!target_lib_names) {
r_list_free (bins);
return NULL;
}
deps = R_NEWS0 (int, cache->hdr->imagesCount);
if (!deps) {
r_list_free (bins);
r_list_free (target_lib_names);
return NULL;
}
}
ut32 i;
for (i = 0; i < cache->n_hdr; i++) {
cache_hdr_t *hdr = &cache->hdr[i];
ut64 hdr_offset = cache->hdr_offset[i];
ut32 maps_index = cache->maps_index[i];
cache_img_t *img = read_cache_images (cache->buf, hdr, hdr_offset);
if (!img) {
goto next;
}
ut32 j;
if (target_libs) {
HtPU *path_to_idx = NULL;
if (cache->accel) {
depArray = R_NEWS0 (ut16, cache->accel->depListCount);
if (!depArray) {
goto next;
}
if (r_buf_fread_at (cache->buf, cache->accel->depListOffset, (ut8*) depArray, "s", cache->accel->depListCount) != cache->accel->depListCount * 2) {
goto next;
}
extras = read_cache_imgextra (cache->buf, hdr, cache->accel);
if (!extras) {
goto next;
}
} else {
path_to_idx = create_path_to_index (cache->buf, img, hdr);
}
for (j = 0; j < hdr->imagesCount; j++) {
bool printing = !deps[j];
char *lib_name = get_lib_name (cache->buf, &img[j]);
if (!lib_name) {
break;
}
if (strstr (lib_name, "libobjc.A.dylib")) {
deps[j]++;
}
if (!r_list_find (target_lib_names, lib_name, string_contains)) {
R_FREE (lib_name);
continue;
}
if (printing) {
eprintf ("FILTER: %s\n", lib_name);
}
R_FREE (lib_name);
deps[j]++;
if (extras && depArray) {
ut32 k;
for (k = extras[j].dependentsStartArrayIndex; depArray[k] != 0xffff; k++) {
ut16 dep_index = depArray[k] & 0x7fff;
deps[dep_index]++;
char *dep_name = get_lib_name (cache->buf, &img[dep_index]);
if (!dep_name) {
break;
}
if (printing) {
eprintf ("-> %s\n", dep_name);
}
free (dep_name);
}
} else if (path_to_idx) {
carve_deps_at_address (cache, img, path_to_idx, img[j].address, deps, printing);
}
}
ht_pu_free (path_to_idx);
R_FREE (depArray);
R_FREE (extras);
}
for (j = 0; j < hdr->imagesCount; j++) {
if (deps && !deps[j]) {
continue;
}
ut64 pa = va2pa (img[j].address, hdr->mappingCount, &cache->maps[maps_index], cache->buf, 0, NULL, NULL);
if (pa == UT64_MAX) {
continue;
}
ut8 magicbytes[4];
r_buf_read_at (cache->buf, pa, magicbytes, 4);
int magic = r_read_le32 (magicbytes);
switch (magic) {
case MH_MAGIC_64:
{
char file[256];
RDyldBinImage *bin = R_NEW0 (RDyldBinImage);
if (!bin) {
goto next;
}
bin->header_at = pa;
bin->hdr_offset = hdr_offset;
bin->symbols_off = resolve_symbols_off (cache, pa);
bin->va = img[j].address;
if (r_buf_read_at (cache->buf, img[j].pathFileOffset, (ut8*) &file, sizeof (file)) == sizeof (file)) {
file[255] = 0;
char *last_slash = strrchr (file, '/');
if (last_slash && *last_slash) {
if (last_slash > file) {
char *scan = last_slash - 1;
while (scan > file && *scan != '/') {
scan--;
}
if (*scan == '/') {
bin->file = strdup (scan + 1);
} else {
bin->file = strdup (last_slash + 1);
}
} else {
bin->file = strdup (last_slash + 1);
}
} else {
bin->file = strdup (file);
}
}
r_list_append (bins, bin);
break;
}
default:
eprintf ("Unknown sub-bin\n");
break;
}
}
next:
R_FREE (depArray);
R_FREE (extras);
R_FREE (img);
}
if (r_list_empty (bins)) {
r_list_free (bins);
bins = NULL;
}
R_FREE (deps);
R_FREE (target_libs);
r_list_free (target_lib_names);
return bins;
}
| 1
|
418,792
|
reset_held_button()
{
held_button = MOUSE_RELEASE;
}
| 0
|
393,487
|
static SQInteger class_getbase(HSQUIRRELVM v)
{
return SQ_SUCCEEDED(sq_getbase(v,-1))?1:SQ_ERROR;
}
| 0
|
344,782
|
argv_free(char **av, int ac)
{
int i;
if (av == NULL)
return;
for (i = 0; i < ac; i++)
free(av[i]);
free(av);
}
| 0
|
450,367
|
static void vnc_client_cache_addr(VncState *client)
{
Error *err = NULL;
client->info = g_malloc0(sizeof(*client->info));
vnc_init_basic_info_from_remote_addr(client->sioc,
qapi_VncClientInfo_base(client->info),
&err);
client->info->websocket = client->websocket;
if (err) {
qapi_free_VncClientInfo(client->info);
client->info = NULL;
error_free(err);
}
}
| 0
|
512,756
|
bool Item_func_case::time_op(THD *thd, MYSQL_TIME *ltime)
{
DBUG_ASSERT(fixed == 1);
Item *item= find_item();
if (!item)
return (null_value= true);
return (null_value= Time(thd, item).copy_to_mysql_time(ltime));
}
| 0
|
234,829
|
void btrfs_get_bbio(struct btrfs_bio *bbio)
{
WARN_ON(!refcount_read(&bbio->refs));
refcount_inc(&bbio->refs);
}
| 0
|
309,847
|
usage(void)
{
static const char *msg[] =
{
"Usage: dots_termcap [options]"
,""
,"Options:"
," -T TERM override $TERM"
," -e allow environment $LINES / $COLUMNS"
," -m SIZE set margin (default: 2)"
," -r SECS self-interrupt/exit after specified number of seconds"
," -s MSECS delay 1% of the time (default: 1 msecs)"
};
size_t n;
for (n = 0; n < SIZEOF(msg); n++)
fprintf(stderr, "%s\n", msg[n]);
ExitProgram(EXIT_FAILURE);
}
| 0
|
308,183
|
static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
{
struct device *dev = ctx->fl->sctx->dev;
struct fastrpc_remote_arg *rpra;
struct fastrpc_invoke_buf *list;
struct fastrpc_phy_page *pages;
int inbufs, i, oix, err = 0;
u64 len, rlen, pkt_size;
u64 pg_start, pg_end;
uintptr_t args;
int metalen;
inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
metalen = fastrpc_get_meta_size(ctx);
pkt_size = fastrpc_get_payload_size(ctx, metalen);
err = fastrpc_create_maps(ctx);
if (err)
return err;
ctx->msg_sz = pkt_size;
err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf);
if (err)
return err;
rpra = ctx->buf->virt;
list = ctx->buf->virt + ctx->nscalars * sizeof(*rpra);
pages = ctx->buf->virt + ctx->nscalars * (sizeof(*list) +
sizeof(*rpra));
args = (uintptr_t)ctx->buf->virt + metalen;
rlen = pkt_size - metalen;
ctx->rpra = rpra;
for (oix = 0; oix < ctx->nbufs; ++oix) {
int mlen;
i = ctx->olaps[oix].raix;
len = ctx->args[i].length;
rpra[i].pv = 0;
rpra[i].len = len;
list[i].num = len ? 1 : 0;
list[i].pgidx = i;
if (!len)
continue;
if (ctx->maps[i]) {
struct vm_area_struct *vma = NULL;
rpra[i].pv = (u64) ctx->args[i].ptr;
pages[i].addr = ctx->maps[i]->phys;
vma = find_vma(current->mm, ctx->args[i].ptr);
if (vma)
pages[i].addr += ctx->args[i].ptr -
vma->vm_start;
pg_start = (ctx->args[i].ptr & PAGE_MASK) >> PAGE_SHIFT;
pg_end = ((ctx->args[i].ptr + len - 1) & PAGE_MASK) >>
PAGE_SHIFT;
pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE;
} else {
if (ctx->olaps[oix].offset == 0) {
rlen -= ALIGN(args, FASTRPC_ALIGN) - args;
args = ALIGN(args, FASTRPC_ALIGN);
}
mlen = ctx->olaps[oix].mend - ctx->olaps[oix].mstart;
if (rlen < mlen)
goto bail;
rpra[i].pv = args - ctx->olaps[oix].offset;
pages[i].addr = ctx->buf->phys -
ctx->olaps[oix].offset +
(pkt_size - rlen);
pages[i].addr = pages[i].addr & PAGE_MASK;
pg_start = (args & PAGE_MASK) >> PAGE_SHIFT;
pg_end = ((args + len - 1) & PAGE_MASK) >> PAGE_SHIFT;
pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE;
args = args + mlen;
rlen -= mlen;
}
if (i < inbufs && !ctx->maps[i]) {
void *dst = (void *)(uintptr_t)rpra[i].pv;
void *src = (void *)(uintptr_t)ctx->args[i].ptr;
if (!kernel) {
if (copy_from_user(dst, (void __user *)src,
len)) {
err = -EFAULT;
goto bail;
}
} else {
memcpy(dst, src, len);
}
}
}
for (i = ctx->nbufs; i < ctx->nscalars; ++i) {
rpra[i].pv = (u64) ctx->args[i].ptr;
rpra[i].len = ctx->args[i].length;
list[i].num = ctx->args[i].length ? 1 : 0;
list[i].pgidx = i;
pages[i].addr = ctx->maps[i]->phys;
pages[i].size = ctx->maps[i]->size;
}
bail:
if (err)
dev_err(dev, "Error: get invoke args failed:%d\n", err);
return err;
}
| 0
|
244,326
|
GF_Err metx_box_size(GF_Box *s)
{
GF_MetaDataSampleEntryBox *ptr = (GF_MetaDataSampleEntryBox *)s;
ptr->size += 8;
if (ptr->type!=GF_ISOM_BOX_TYPE_STPP) {
if (ptr->content_encoding)
ptr->size += strlen(ptr->content_encoding);
ptr->size++;
}
if ((ptr->type==GF_ISOM_BOX_TYPE_METX) || (ptr->type==GF_ISOM_BOX_TYPE_STPP)) {
if (ptr->xml_namespace)
ptr->size += strlen(ptr->xml_namespace);
ptr->size++;
if (ptr->xml_schema_loc)
ptr->size += strlen(ptr->xml_schema_loc);
ptr->size++;
if (ptr->type==GF_ISOM_BOX_TYPE_STPP) {
if (ptr->mime_type)
ptr->size += strlen(ptr->mime_type);
ptr->size++;
}
}
//mett, sbtt, stxt
else {
if (ptr->mime_type)
ptr->size += strlen(ptr->mime_type);
ptr->size++;
}
return GF_OK;
}
| 0
|
220,210
|
Status Node::input_node(int idx, Node** n) const {
const Edge* e;
TF_RETURN_IF_ERROR(input_edge(idx, &e));
if (e == nullptr) {
*n = nullptr;
} else {
*n = e->src();
}
return Status::OK();
}
| 0
|
417,123
|
void PlayerGeneric::setRepeat(bool repeat)
{
this->repeat = repeat;
if (player)
player->setRepeat(repeat);
}
| 0
|
413,647
|
R_API int r_core_anal_esil_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth) {
const char *esil;
eprintf ("TODO\n");
while (1) {
// TODO: Implement the proper logic for doing esil analysis
RAnalOp *op = r_core_anal_op (core, at, R_ANAL_OP_MASK_ESIL);
if (!op) {
break;
}
esil = R_STRBUF_SAFEGET (&op->esil);
eprintf ("0x%08"PFMT64x" %d %s\n", at, op->size, esil);
// at += op->size;
// esilIsRet()
// esilIsCall()
// esilIsJmp()
r_anal_op_free (op);
break;
}
return 0;
}
| 0
|
237,879
|
qeh_write_type (struct qpack_enc_hdl *qeh)
{
int s;
#ifndef NDEBUG
const char *env = getenv("LSQUIC_RND_VARINT_LEN");
if (env && atoi(env))
{
s = rand() & 3;
LSQ_DEBUG("writing %d-byte stream type", 1 << s);
}
else
#endif
s = 0;
switch (s)
{
case 0:
return lsquic_frab_list_write(&qeh->qeh_fral,
(unsigned char []) { HQUST_QPACK_ENC }, 1);
case 1:
return lsquic_frab_list_write(&qeh->qeh_fral,
(unsigned char []) { 0x40, HQUST_QPACK_ENC }, 2);
case 2:
return lsquic_frab_list_write(&qeh->qeh_fral,
(unsigned char []) { 0x80, 0x00, 0x00, HQUST_QPACK_ENC }, 4);
default:
return lsquic_frab_list_write(&qeh->qeh_fral,
(unsigned char []) { 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
HQUST_QPACK_ENC }, 8);
}
}
| 0
|
328,947
|
R_API char *r_bin_java_print_methodhandle_cp_stringify(RBinJavaCPTypeObj *obj) {
ut8 ref_kind = obj->info.cp_method_handle.reference_kind;
return r_str_newf ("%d.0x%04"PFMT64x ".%s.%s.%d",
obj->metas->ord, obj->file_offset + obj->loadaddr, ((RBinJavaCPTypeMetas *) obj->metas->type_info)->name,
R_BIN_JAVA_REF_METAS[ref_kind].name, obj->info.cp_method_handle.reference_index);
}
| 0
|
427,153
|
static void singlevar (LexState *ls, expdesc *var) {
TString *varname = str_checkname(ls);
FuncState *fs = ls->fs;
singlevaraux(fs, varname, var, 1);
if (var->k == VVOID) { /* global name? */
expdesc key;
singlevaraux(fs, ls->envn, var, 1); /* get environment variable */
lua_assert(var->k != VVOID); /* this one must exist */
luaK_exp2anyregup(fs, var); /* but could be a constant */
codestring(&key, varname); /* key is variable name */
luaK_indexed(fs, var, &key); /* env[varname] */
}
}
| 0
|
468,363
|
g_socket_client_tls_handshake_callback (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
GSocketClientAsyncConnectData *data = user_data;
if (g_tls_connection_handshake_finish (G_TLS_CONNECTION (object),
result,
&data->last_error))
{
g_object_unref (data->connection);
data->connection = G_IO_STREAM (object);
g_socket_client_emit_event (data->client, G_SOCKET_CLIENT_TLS_HANDSHAKED, data->connectable, data->connection);
g_socket_client_async_connect_complete (data);
}
else
{
g_object_unref (object);
enumerator_next_async (data, FALSE);
}
}
| 0
|
413,687
|
static int is_string(const ut8 *buf, int size, int *len) {
int i, fakeLen = 0;
if (size < 1) {
return 0;
}
if (!len) {
len = &fakeLen;
}
if (size > 3 && buf[0] && !buf[1] && buf[2] && !buf[3]) {
*len = 1; // XXX: TODO: Measure wide string length
return 2; // is wide
}
for (i = 0; i < size; i++) {
if (!buf[i] && i > MINLEN) {
*len = i;
return 1;
}
if (buf[i] == 10 || buf[i] == 13 || buf[i] == 9) {
continue;
}
if (buf[i] < 32 || buf[i] > 127) {
// not ascii text
return 0;
}
if (!IS_PRINTABLE (buf[i])) {
*len = i;
return 0;
}
}
*len = i;
return 1;
}
| 0
|
224,175
|
std::size_t get_tuple_bytes(const Tuple& tuple) {
return std::accumulate(tuple.begin(), tuple.end(),
static_cast<std::size_t>(0),
[](const std::size_t& lhs, const Tensor& rhs) {
return lhs + rhs.TotalBytes();
});
}
| 0
|
343,168
|
static int esp4_rcv_cb(struct sk_buff *skb, int err)
{
return 0;
}
| 0
|
231,023
|
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet )
{
QueueSetMemberHandle_t xReturn = NULL;
( void ) xQueueReceiveFromISR( ( QueueHandle_t ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */
return xReturn;
}
| 0
|
417,117
|
void PlayerGeneric::setPlayMode(PlayModes mode)
{
playMode = mode;
if (player)
player->setPlayMode(mode);
}
| 0
|
241,311
|
mrb_remove_method(mrb_state *mrb, struct RClass *c, mrb_sym mid)
{
mt_tbl *h;
MRB_CLASS_ORIGIN(c);
h = c->mt;
if (h && mt_del(mrb, h, mid)) {
mrb_mc_clear_by_class(mrb, c);
return;
}
mrb_name_error(mrb, mid, "method '%n' not defined in %C", mid, c);
}
| 0
|
400,120
|
void LogHandler::setupLogFile(el::Configurations *defaultConf, string filename,
string maxlogsize) {
// Enable strict log file size check
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
defaultConf->setGlobally(el::ConfigurationType::Filename, filename);
defaultConf->setGlobally(el::ConfigurationType::ToFile, "true");
defaultConf->setGlobally(el::ConfigurationType::MaxLogFileSize, maxlogsize);
}
| 0
|
272,343
|
generate_signature(cms_context *cms)
{
int rc = 0;
if (cms->digests[cms->selected_digest].pe_digest == NULL)
cnreterr(-1, cms, "PE digest has not been allocated");
if (content_is_empty(cms->digests[cms->selected_digest].pe_digest->data,
cms->digests[cms->selected_digest].pe_digest->len))
cnreterr(-1, cms, "PE binary has not been digested");
SECItem sd_der;
memset(&sd_der, '\0', sizeof(sd_der));
rc = generate_spc_signed_data(cms, &sd_der);
if (rc < 0)
cnreterr(-1, cms, "could not create signed data");
memcpy(&cms->newsig, &sd_der, sizeof (cms->newsig));
cms->newsig.data = malloc(sd_der.len);
if (!cms->newsig.data)
cnreterr(-1, cms, "could not allocate signed data");
memcpy(cms->newsig.data, sd_der.data, sd_der.len);
return 0;
}
| 0
|
231,686
|
bool verifyFramePresent(
std::vector<std::unique_ptr<folly::IOBuf>>& socketWrites,
QuicReadCodec& readCodec,
QuicFrame::Type frameType) {
AckStates ackStates;
for (auto& write : socketWrites) {
auto packetQueue = bufToQueue(write->clone());
auto result = readCodec.parsePacket(packetQueue, ackStates);
auto regularPacket = result.regularPacket();
if (!regularPacket) {
continue;
}
for (FOLLY_MAYBE_UNUSED auto& frame : regularPacket->frames) {
if (frame.type() != frameType) {
continue;
}
return true;
}
}
return false;
}
| 0
|
349,268
|
static void squashfs_stat(char *source)
{
time_t mkfs_time = (time_t) sBlk.s.mkfs_time;
struct tm *t = use_localtime ? localtime(&mkfs_time) :
gmtime(&mkfs_time);
char *mkfs_str = asctime(t);
#if __BYTE_ORDER == __BIG_ENDIAN
printf("Found a valid %sSQUASHFS %d:%d superblock on %s.\n",
swap ? "little endian " : "big endian ", sBlk.s.s_major,
sBlk.s.s_minor, source);
#else
printf("Found a valid %sSQUASHFS %d:%d superblock on %s.\n",
swap ? "big endian " : "little endian ", sBlk.s.s_major,
sBlk.s.s_minor, source);
#endif
printf("Creation or last append time %s", mkfs_str ? mkfs_str :
"failed to get time\n");
printf("Filesystem size %llu bytes (%.2f Kbytes / %.2f Mbytes)\n",
sBlk.s.bytes_used, sBlk.s.bytes_used / 1024.0,
sBlk.s.bytes_used / (1024.0 * 1024.0));
printf("Block size %d\n", sBlk.s.block_size);
printf("Filesystem is %sexportable via NFS\n",
SQUASHFS_EXPORTABLE(sBlk.s.flags) ? "" : "not ");
printf("Inodes are %scompressed\n",
SQUASHFS_UNCOMPRESSED_INODES(sBlk.s.flags) ? "un" : "");
printf("Data is %scompressed\n",
SQUASHFS_UNCOMPRESSED_DATA(sBlk.s.flags) ? "un" : "");
if(SQUASHFS_NO_FRAGMENTS(sBlk.s.flags))
printf("Fragments are not stored\n");
else {
printf("Fragments are %scompressed\n",
SQUASHFS_UNCOMPRESSED_FRAGMENTS(sBlk.s.flags) ? "un" : "");
printf("Always-use-fragments option is %sspecified\n",
SQUASHFS_ALWAYS_FRAGMENTS(sBlk.s.flags) ? "" : "not ");
}
printf("Check data is %spresent in the filesystem\n",
SQUASHFS_CHECK_DATA(sBlk.s.flags) ? "" : "not ");
printf("Duplicates are %sremoved\n", SQUASHFS_DUPLICATES(sBlk.s.flags) ? "" : "not ");
printf("Number of fragments %d\n", sBlk.s.fragments);
printf("Number of inodes %d\n", sBlk.s.inodes);
printf("Number of uids %d\n", sBlk.no_uids);
printf("Number of gids %d\n", sBlk.no_guids);
TRACE("sBlk.s.inode_table_start 0x%llx\n", sBlk.s.inode_table_start);
TRACE("sBlk.s.directory_table_start 0x%llx\n", sBlk.s.directory_table_start);
TRACE("sBlk.s.fragment_table_start 0x%llx\n\n", sBlk.s.fragment_table_start);
TRACE("sBlk.uid_start 0x%llx\n", sBlk.uid_start);
TRACE("sBlk.guid_start 0x%llx\n", sBlk.guid_start);
}
| 0
|
244,081
|
GF_Err udta_box_size(GF_Box *s)
{
GF_Err e;
u32 i;
GF_UserDataMap *map;
GF_UserDataBox *ptr = (GF_UserDataBox *)s;
i=0;
while ((map = (GF_UserDataMap *)gf_list_enum(ptr->recordList, &i))) {
//warning: here we are not passing the actual "parent" of the list
//but the UDTA box. The parent itself is not an box, we don't care about it
e = gf_isom_box_array_size(s, map->boxes);
if (e) return e;
}
return GF_OK;
}
| 0
|
484,748
|
static int xennet_xdp_set(struct net_device *dev, struct bpf_prog *prog,
struct netlink_ext_ack *extack)
{
unsigned long max_mtu = XEN_PAGE_SIZE - XDP_PACKET_HEADROOM;
struct netfront_info *np = netdev_priv(dev);
struct bpf_prog *old_prog;
unsigned int i, err;
if (dev->mtu > max_mtu) {
netdev_warn(dev, "XDP requires MTU less than %lu\n", max_mtu);
return -EINVAL;
}
if (!np->netback_has_xdp_headroom)
return 0;
xenbus_switch_state(np->xbdev, XenbusStateReconfiguring);
err = talk_to_netback_xdp(np, prog ? NETBACK_XDP_HEADROOM_ENABLE :
NETBACK_XDP_HEADROOM_DISABLE);
if (err)
return err;
/* avoid the race with XDP headroom adjustment */
wait_event(module_wq,
xenbus_read_driver_state(np->xbdev->otherend) ==
XenbusStateReconfigured);
np->netfront_xdp_enabled = true;
old_prog = rtnl_dereference(np->queues[0].xdp_prog);
if (prog)
bpf_prog_add(prog, dev->real_num_tx_queues);
for (i = 0; i < dev->real_num_tx_queues; ++i)
rcu_assign_pointer(np->queues[i].xdp_prog, prog);
if (old_prog)
for (i = 0; i < dev->real_num_tx_queues; ++i)
bpf_prog_put(old_prog);
xenbus_switch_state(np->xbdev, XenbusStateConnected);
return 0;
}
| 0
|
387,790
|
void InstanceKlass::process_interfaces(Thread *thread) {
// link this class into the implementors list of every interface it implements
for (int i = local_interfaces()->length() - 1; i >= 0; i--) {
assert(local_interfaces()->at(i)->is_klass(), "must be a klass");
InstanceKlass* interf = InstanceKlass::cast(local_interfaces()->at(i));
assert(interf->is_interface(), "expected interface");
interf->add_implementor(this);
}
}
| 0
|
313,734
|
adjust_cursor(oparg_T *oap)
{
// The cursor cannot remain on the NUL when:
// - the column is > 0
// - not in Visual mode or 'selection' is "o"
// - 'virtualedit' is not "all" and not "onemore".
if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL
&& (!VIsual_active || *p_sel == 'o')
&& !virtual_active() && (get_ve_flags() & VE_ONEMORE) == 0)
{
--curwin->w_cursor.col;
// prevent cursor from moving on the trail byte
if (has_mbyte)
mb_adjust_cursor();
oap->inclusive = TRUE;
}
}
| 0
|
412,331
|
static bool check_buffer(RzBuffer *buf) {
ut8 tmp[6];
int r = rz_buf_read_at(buf, 0, tmp, sizeof(tmp));
return r == sizeof(tmp) && !memcmp(tmp, QNX_MAGIC, sizeof(tmp));
}
| 0
|
359,657
|
community_list_config_write (struct vty *vty)
{
struct community_list *list;
struct community_entry *entry;
struct community_list_master *cm;
int write = 0;
/* Community-list. */
cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
for (list = cm->num.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next)
{
vty_out (vty, "ip community-list %s %s %s%s",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry),
VTY_NEWLINE);
write++;
}
for (list = cm->str.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next)
{
vty_out (vty, "ip community-list %s %s %s %s%s",
entry->style == COMMUNITY_LIST_STANDARD
? "standard" : "expanded",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry),
VTY_NEWLINE);
write++;
}
/* Extcommunity-list. */
cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
for (list = cm->num.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next)
{
vty_out (vty, "ip extcommunity-list %s %s %s%s",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry), VTY_NEWLINE);
write++;
}
for (list = cm->str.head; list; list = list->next)
for (entry = list->head; entry; entry = entry->next)
{
vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
entry->style == EXTCOMMUNITY_LIST_STANDARD
? "standard" : "expanded",
list->name, community_direct_str (entry->direct),
community_list_config_str (entry), VTY_NEWLINE);
write++;
}
return write;
}
| 0
|
231,698
|
void onServerCloseOpenState(QuicServerConnectionState& conn) {
conn.state = ServerState::Closed;
}
| 0
|
374,036
|
static void header(RBinFile *bf) {
r_return_if_fail (bf && bf->o);
RCoreSymCacheElement *element = bf->o->bin_obj;
if (!element) {
return;
}
RBin *bin = bf->rbin;
PrintfCallback p = bin->cb_printf;
PJ *pj = pj_new ();
if (!pj) {
return;
}
pj_o (pj);
pj_kn (pj, "cs_version", element->hdr->version);
pj_kn (pj, "size", element->hdr->size);
if (element->file_name) {
pj_ks (pj, "name", element->file_name);
}
if (element->binary_version) {
pj_ks (pj, "version", element->binary_version);
}
char uuidstr[R_UUID_LENGTH];
r_hex_bin2str (element->hdr->uuid, 16, uuidstr);
pj_ks (pj, "uuid", uuidstr);
pj_kn (pj, "segments", element->hdr->n_segments);
pj_kn (pj, "sections", element->hdr->n_sections);
pj_kn (pj, "symbols", element->hdr->n_symbols);
pj_kn (pj, "lined_symbols", element->hdr->n_lined_symbols);
pj_kn (pj, "line_info", element->hdr->n_line_info);
pj_end (pj);
p ("%s\n", pj_string (pj));
pj_free (pj);
}
| 0
|
262,803
|
void Compute(OpKernelContext* context) override {
// Read ragged_splits inputs.
OpInputList ragged_nested_splits_in;
OP_REQUIRES_OK(context, context->input_list("rt_nested_splits",
&ragged_nested_splits_in));
const int ragged_nested_splits_len = ragged_nested_splits_in.size();
RaggedTensorVariant batched_ragged_input;
// Read ragged_values input.
batched_ragged_input.set_values(context->input(ragged_nested_splits_len));
batched_ragged_input.mutable_nested_splits()->reserve(
ragged_nested_splits_len);
for (int i = 0; i < ragged_nested_splits_len; i++) {
batched_ragged_input.append_splits(ragged_nested_splits_in[i]);
}
if (!batched_input_) {
// Encode as a Scalar Variant Tensor.
Tensor* encoded_scalar;
OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape({}),
&encoded_scalar));
encoded_scalar->scalar<Variant>()() = std::move(batched_ragged_input);
return;
}
// Checked here instead of at input in case batched_input_ is false
OP_REQUIRES(context, ragged_nested_splits_len > 0,
errors::InvalidArgument(
"rt_nested_splits must be a list of one or more, but "
"received rt_nested_splits of length 0."));
// Unbatch the Ragged Tensor and encode the components.
std::vector<RaggedTensorVariant> unbatched_ragged_input;
auto batched_splits_top_vec =
batched_ragged_input.splits(0).vec<SPLIT_TYPE>();
int num_components = batched_splits_top_vec.size() - 1;
OP_REQUIRES(context, num_components >= 0,
errors::Internal("Invalid split argument."));
OP_REQUIRES_OK(context, UnbatchRaggedZerothDim<VALUE_TYPE, SPLIT_TYPE>(
batched_ragged_input, &unbatched_ragged_input));
// Bundle the encoded scalar Variant Tensors into a rank-1 Variant Tensor.
Tensor* encoded_vector;
int output_size = unbatched_ragged_input.size();
OP_REQUIRES_OK(context,
context->allocate_output(0, TensorShape({output_size}),
&encoded_vector));
auto encoded_vector_t = encoded_vector->vec<Variant>();
for (int i = 0; i < output_size; i++) {
encoded_vector_t(i) = unbatched_ragged_input[i];
}
}
| 0
|
430,424
|
int ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,
const struct sw_flow_key *key,
struct sw_flow_actions **sfa, bool log)
{
int err;
u32 mpls_label_count = 0;
*sfa = nla_alloc_flow_actions(min(nla_len(attr), MAX_ACTIONS_BUFSIZE));
if (IS_ERR(*sfa))
return PTR_ERR(*sfa);
if (eth_p_mpls(key->eth.type))
mpls_label_count = hweight_long(key->mpls.num_labels_mask);
(*sfa)->orig_len = nla_len(attr);
err = __ovs_nla_copy_actions(net, attr, key, sfa, key->eth.type,
key->eth.vlan.tci, mpls_label_count, log);
if (err)
ovs_nla_free_flow_actions(*sfa);
return err;
}
| 0
|
220,244
|
const Edge* Graph::AddControlEdge(Node* source, Node* dest,
bool allow_duplicates) {
if (!allow_duplicates) {
for (const Edge* edge : dest->in_edges()) {
if (edge->IsControlEdge() && edge->src() == source) {
// The requested edge already exists.
return nullptr;
}
}
}
// Modify dest's NodeDef if necessary.
if (!source->IsSource() && !dest->IsSink() && !allow_duplicates) {
// Check if this input is already in dest's NodeDef.
const std::string new_input = strings::StrCat("^", source->name());
bool input_exists = false;
for (const std::string& input : dest->props_->node_def.input()) {
if (input == new_input) {
input_exists = true;
break;
}
}
if (!input_exists) {
dest->MaybeCopyOnWrite();
dest->props_->node_def.add_input(new_input);
}
}
return AddEdge(source, kControlSlot, dest, kControlSlot);
}
| 0
|
241,058
|
int client_add(int fd, const struct booth_transport *tpt,
void (*workfn)(int ci),
void (*deadfn)(int ci))
{
int i;
struct client *c;
if (client_size - 1 <= client_maxi ) {
client_alloc();
}
for (i = 0; i < client_size; i++) {
c = clients + i;
if (c->fd != -1)
continue;
c->workfn = workfn;
if (deadfn)
c->deadfn = deadfn;
else
c->deadfn = client_dead;
c->transport = tpt;
c->fd = fd;
c->msg = NULL;
c->offset = 0;
pollfds[i].fd = fd;
pollfds[i].events = POLLIN;
if (i > client_maxi)
client_maxi = i;
return i;
}
assert(!"no client");
}
| 0
|
195,403
|
TfLiteIntArray* TfLiteIntArrayCreate(int size) {
int alloc_size = TfLiteIntArrayGetSizeInBytes(size);
if (alloc_size <= 0) return NULL;
TfLiteIntArray* ret = (TfLiteIntArray*)malloc(alloc_size);
if (!ret) return ret;
ret->size = size;
return ret;
}
| 1
|
384,199
|
int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain)
{
struct nft_expr *expr, *last;
const struct nft_data *data;
struct nft_rule *rule;
int err;
if (ctx->level == NFT_JUMP_STACK_SIZE)
return -EMLINK;
list_for_each_entry(rule, &chain->rules, list) {
if (!nft_is_active_next(ctx->net, rule))
continue;
nft_rule_for_each_expr(expr, last, rule) {
if (!expr->ops->validate)
continue;
err = expr->ops->validate(ctx, expr, &data);
if (err < 0)
return err;
}
cond_resched();
}
return 0;
}
| 0
|
195,246
|
static s32 avc_parse_slice(GF_BitStream *bs, AVCState *avc, Bool svc_idr_flag, AVCSliceInfo *si)
{
s32 pps_id, num_ref_idx_l0_active_minus1 = 0, num_ref_idx_l1_active_minus1 = 0;
/*s->current_picture.reference= h->nal_ref_idc != 0;*/
gf_bs_read_ue_log(bs, "first_mb_in_slice");
si->slice_type = gf_bs_read_ue_log(bs, "slice_type");
if (si->slice_type > 9) return -1;
pps_id = gf_bs_read_ue_log(bs, "pps_id");
if (pps_id > 255) return -1;
si->pps = &avc->pps[pps_id];
if (!si->pps->slice_group_count) return -2;
si->sps = &avc->sps[si->pps->sps_id];
if (!si->sps->log2_max_frame_num) return -2;
avc->sps_active_idx = si->pps->sps_id;
avc->pps_active_idx = pps_id;
si->frame_num = gf_bs_read_int_log(bs, si->sps->log2_max_frame_num, "frame_num");
si->field_pic_flag = 0;
si->bottom_field_flag = 0;
if (!si->sps->frame_mbs_only_flag) {
si->field_pic_flag = gf_bs_read_int_log(bs, 1, "field_pic_flag");
if (si->field_pic_flag)
si->bottom_field_flag = gf_bs_read_int_log(bs, 1, "bottom_field_flag");
}
if ((si->nal_unit_type == GF_AVC_NALU_IDR_SLICE) || svc_idr_flag)
si->idr_pic_id = gf_bs_read_ue_log(bs, "idr_pic_id");
if (si->sps->poc_type == 0) {
si->poc_lsb = gf_bs_read_int_log(bs, si->sps->log2_max_poc_lsb, "poc_lsb");
if (si->pps->pic_order_present && !si->field_pic_flag) {
si->delta_poc_bottom = gf_bs_read_se_log(bs, "poc_lsb");
}
}
else if ((si->sps->poc_type == 1) && !si->sps->delta_pic_order_always_zero_flag) {
si->delta_poc[0] = gf_bs_read_se_log(bs, "delta_poc0");
if ((si->pps->pic_order_present == 1) && !si->field_pic_flag)
si->delta_poc[1] = gf_bs_read_se_log(bs, "delta_poc1");
}
if (si->pps->redundant_pic_cnt_present) {
si->redundant_pic_cnt = gf_bs_read_ue_log(bs, "redundant_pic_cnt");
}
if (si->slice_type % 5 == GF_AVC_TYPE_B) {
gf_bs_read_int_log(bs, 1, "direct_spatial_mv_pred_flag");
}
num_ref_idx_l0_active_minus1 = si->pps->num_ref_idx_l0_default_active_minus1;
num_ref_idx_l1_active_minus1 = si->pps->num_ref_idx_l1_default_active_minus1;
if (si->slice_type % 5 == GF_AVC_TYPE_P || si->slice_type % 5 == GF_AVC_TYPE_SP || si->slice_type % 5 == GF_AVC_TYPE_B) {
Bool num_ref_idx_active_override_flag = gf_bs_read_int_log(bs, 1, "num_ref_idx_active_override_flag");
if (num_ref_idx_active_override_flag) {
num_ref_idx_l0_active_minus1 = gf_bs_read_ue_log(bs, "num_ref_idx_l0_active_minus1");
if (si->slice_type % 5 == GF_AVC_TYPE_B) {
num_ref_idx_l1_active_minus1 = gf_bs_read_ue_log(bs, "num_ref_idx_l1_active_minus1");
}
}
}
if (si->nal_unit_type == 20 || si->nal_unit_type == 21) {
//ref_pic_list_mvc_modification(); /* specified in Annex H */
GF_LOG(GF_LOG_ERROR, GF_LOG_CODING, ("[avc-h264] unimplemented ref_pic_list_mvc_modification() in slide header\n"));
assert(0);
return -1;
}
else {
ref_pic_list_modification(bs, si->slice_type);
}
if ((si->pps->weighted_pred_flag && (si->slice_type % 5 == GF_AVC_TYPE_P || si->slice_type % 5 == GF_AVC_TYPE_SP))
|| (si->pps->weighted_bipred_idc == 1 && si->slice_type % 5 == GF_AVC_TYPE_B)) {
pred_weight_table(bs, si->slice_type, si->sps->ChromaArrayType, num_ref_idx_l0_active_minus1, num_ref_idx_l1_active_minus1);
}
if (si->nal_ref_idc != 0) {
dec_ref_pic_marking(bs, (si->nal_unit_type == GF_AVC_NALU_IDR_SLICE));
}
if (si->pps->entropy_coding_mode_flag && si->slice_type % 5 != GF_AVC_TYPE_I && si->slice_type % 5 != GF_AVC_TYPE_SI) {
gf_bs_read_ue_log(bs, "cabac_init_idc");
}
/*slice_qp_delta = */gf_bs_read_se(bs);
if (si->slice_type % 5 == GF_AVC_TYPE_SP || si->slice_type % 5 == GF_AVC_TYPE_SI) {
if (si->slice_type % 5 == GF_AVC_TYPE_SP) {
gf_bs_read_int_log(bs, 1, "sp_for_switch_flag");
}
gf_bs_read_se_log(bs, "slice_qs_delta");
}
if (si->pps->deblocking_filter_control_present_flag) {
if (gf_bs_read_ue_log(bs, "disable_deblocking_filter_idc") != 1) {
gf_bs_read_se_log(bs, "slice_alpha_c0_offset_div2");
gf_bs_read_se_log(bs, "slice_beta_offset_div2");
}
}
if (si->pps->slice_group_count > 1 && si->pps->mb_slice_group_map_type >= 3 && si->pps->mb_slice_group_map_type <= 5) {
gf_bs_read_int_log(bs, (u32)ceil(log1p((si->pps->pic_size_in_map_units_minus1 + 1) / (si->pps->slice_group_change_rate_minus1 + 1) ) / log(2)), "slice_group_change_cycle");
}
return 0;
}
| 1
|
329,945
|
_cairo_image_bounded_opaque_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,
spans[0].coverage);
spans++;
} while (--num_spans > 1);
return CAIRO_STATUS_SUCCESS;
}
| 0
|
338,061
|
void WasmBinaryWriter::writeDebugLocationEnd(Expression* curr, Function* func) {
if (func && !func->expressionLocations.empty()) {
auto& span = binaryLocations.expressions.at(curr);
span.end = o.size();
}
}
| 0
|
376,315
|
gpg_ctx_set_istream (struct _GpgCtx *gpg,
CamelStream *istream)
{
g_object_ref (istream);
if (gpg->istream)
g_object_unref (gpg->istream);
gpg->istream = istream;
}
| 0
|
508,783
|
bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
SQL_SELECT *select,
SORT_INFO *filesort,
int use_record_cache, bool print_error,
bool disable_rr_cache)
{
IO_CACHE *tempfile;
SORT_ADDON_FIELD *addon_field= filesort ? filesort->addon_field : 0;
DBUG_ENTER("init_read_record");
bzero((char*) info,sizeof(*info));
info->thd=thd;
info->table=table;
info->forms= &info->table; /* Only one table */
info->addon_field= addon_field;
if ((table->s->tmp_table == INTERNAL_TMP_TABLE) &&
!addon_field)
(void) table->file->extra(HA_EXTRA_MMAP);
if (addon_field)
{
info->rec_buf= (uchar*) filesort->addon_buf.str;
info->ref_length= filesort->addon_buf.length;
info->unpack= filesort->unpack;
}
else
{
empty_record(table);
info->record= table->record[0];
info->ref_length= table->file->ref_length;
}
info->select=select;
info->print_error=print_error;
info->unlock_row= rr_unlock_row;
info->ignore_not_found_rows= 0;
table->status= 0; /* Rows are always found */
tempfile= 0;
if (select && my_b_inited(&select->file))
tempfile= &select->file;
else if (filesort && my_b_inited(&filesort->io_cache))
tempfile= &filesort->io_cache;
if (tempfile && !(select && select->quick))
{
DBUG_PRINT("info",("using rr_from_tempfile"));
info->read_record= (addon_field ?
rr_unpack_from_tempfile : rr_from_tempfile);
info->io_cache= tempfile;
reinit_io_cache(info->io_cache,READ_CACHE,0L,0,0);
info->ref_pos=table->file->ref;
if (!table->file->inited)
if (table->file->ha_rnd_init_with_error(0))
DBUG_RETURN(1);
/*
addon_field is checked because if we use addon fields,
it doesn't make sense to use cache - we don't read from the table
and filesort->io_cache is read sequentially
*/
if (!disable_rr_cache &&
!addon_field &&
thd->variables.read_rnd_buff_size &&
!(table->file->ha_table_flags() & HA_FAST_KEY_READ) &&
(table->db_stat & HA_READ_ONLY ||
table->reginfo.lock_type <= TL_READ_NO_INSERT) &&
(ulonglong) table->s->reclength* (table->file->stats.records+
table->file->stats.deleted) >
(ulonglong) MIN_FILE_LENGTH_TO_USE_ROW_CACHE &&
info->io_cache->end_of_file/info->ref_length * table->s->reclength >
(my_off_t) MIN_ROWS_TO_USE_TABLE_CACHE &&
!table->s->blob_fields &&
info->ref_length <= MAX_REFLENGTH)
{
if (! init_rr_cache(thd, info))
{
DBUG_PRINT("info",("using rr_from_cache"));
info->read_record=rr_from_cache;
}
}
}
else if (select && select->quick)
{
DBUG_PRINT("info",("using rr_quick"));
info->read_record=rr_quick;
}
else if (filesort && filesort->record_pointers)
{
DBUG_PRINT("info",("using record_pointers"));
if (table->file->ha_rnd_init_with_error(0))
DBUG_RETURN(1);
info->cache_pos= filesort->record_pointers;
info->cache_end= (info->cache_pos+
filesort->return_rows * info->ref_length);
info->read_record= (addon_field ?
rr_unpack_from_buffer : rr_from_pointers);
}
else if (table->file->keyread_enabled())
{
int error;
info->read_record= rr_index_first;
if (!table->file->inited &&
(error= table->file->ha_index_init(table->file->keyread, 1)))
{
if (print_error)
table->file->print_error(error, MYF(0));
DBUG_RETURN(1);
}
}
else
{
DBUG_PRINT("info",("using rr_sequential"));
info->read_record=rr_sequential;
if (table->file->ha_rnd_init_with_error(1))
DBUG_RETURN(1);
/* We can use record cache if we don't update dynamic length tables */
if (!table->no_cache &&
(use_record_cache > 0 ||
(int) table->reginfo.lock_type <= (int) TL_READ_HIGH_PRIORITY ||
!(table->s->db_options_in_use & HA_OPTION_PACK_RECORD) ||
(use_record_cache < 0 &&
!(table->file->ha_table_flags() & HA_NOT_DELETE_WITH_CACHE))))
(void) table->file->extra_opt(HA_EXTRA_CACHE,
thd->variables.read_buff_size);
}
/* Condition pushdown to storage engine */
if ((table->file->ha_table_flags() & HA_CAN_TABLE_CONDITION_PUSHDOWN) &&
select && select->cond &&
(select->cond->used_tables() & table->map) &&
!table->file->pushed_cond)
table->file->cond_push(select->cond);
DBUG_RETURN(0);
} /* init_read_record */
| 0
|
292,159
|
int LinkResolver::vtable_index_of_interface_method(Klass* klass,
const methodHandle& resolved_method) {
int vtable_index = Method::invalid_vtable_index;
Symbol* name = resolved_method->name();
Symbol* signature = resolved_method->signature();
InstanceKlass* ik = InstanceKlass::cast(klass);
// First check in default method array
if (!resolved_method->is_abstract() && ik->default_methods() != NULL) {
int index = InstanceKlass::find_method_index(ik->default_methods(),
name, signature, Klass::find_overpass,
Klass::find_static, Klass::find_private);
if (index >= 0 ) {
vtable_index = ik->default_vtable_indices()->at(index);
}
}
if (vtable_index == Method::invalid_vtable_index) {
// get vtable_index for miranda methods
klassVtable vt = ik->vtable();
vtable_index = vt.index_of_miranda(name, signature);
}
return vtable_index;
}
| 0
|
483,504
|
static int __init efi_load_efivars(void)
{
struct platform_device *pdev;
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return 0;
pdev = platform_device_register_simple("efivars", 0, NULL, 0);
return PTR_ERR_OR_ZERO(pdev);
}
| 0
|
482,555
|
verifyStringOrDots(const FileInfo *file, TranslationTableOpcode opcode, int isString,
int actionPart, int nofor) {
if (!wantsString(opcode, actionPart, nofor) == !isString) return 1;
compileError(file, "%s are not allowed in the %s part of a %s translation %s rule.",
isString ? "strings" : "dots", getPartName(actionPart),
nofor ? "backward" : "forward", _lou_findOpcodeName(opcode));
return 0;
}
| 0
|
361,742
|
static void request_module_async(struct work_struct *work)
{
struct em28xx *dev = container_of(work,
struct em28xx, request_module_wk);
/*
* The em28xx extensions can be modules or builtin. If the
* modules are already loaded or are built in, those extensions
* can be initialised right now. Otherwise, the module init
* code will do it.
*/
/*
* Devices with an audio-only intf also have a V4L/DVB/RC
* intf. Don't register extensions twice on those devices.
*/
if (dev->is_audio_only) {
#if defined(CONFIG_MODULES) && defined(MODULE)
request_module("em28xx-alsa");
#endif
return;
}
em28xx_init_extension(dev);
#if defined(CONFIG_MODULES) && defined(MODULE)
if (dev->has_video)
request_module("em28xx-v4l");
if (dev->usb_audio_type == EM28XX_USB_AUDIO_CLASS)
request_module("snd-usb-audio");
else if (dev->usb_audio_type == EM28XX_USB_AUDIO_VENDOR)
request_module("em28xx-alsa");
if (dev->board.has_dvb)
request_module("em28xx-dvb");
if (dev->board.buttons ||
((dev->board.ir_codes || dev->board.has_ir_i2c) && !disable_ir))
request_module("em28xx-rc");
#endif /* CONFIG_MODULES */
}
| 0
|
247,604
|
const envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext& clientCtxProto() const {
return client_ctx_proto_;
}
| 0
|
231,712
|
void handleKnobParams(const TransportKnobParams& params) {
handleTransportKnobParams(params);
}
| 0
|
221,389
|
static int nested_svm_intercept(struct vcpu_svm *svm)
{
u32 exit_code = svm->vmcb->control.exit_code;
int vmexit = NESTED_EXIT_HOST;
switch (exit_code) {
case SVM_EXIT_MSR:
vmexit = nested_svm_exit_handled_msr(svm);
break;
case SVM_EXIT_IOIO:
vmexit = nested_svm_intercept_ioio(svm);
break;
case SVM_EXIT_READ_CR0 ... SVM_EXIT_WRITE_CR8: {
if (vmcb_is_intercept(&svm->nested.ctl, exit_code))
vmexit = NESTED_EXIT_DONE;
break;
}
case SVM_EXIT_READ_DR0 ... SVM_EXIT_WRITE_DR7: {
if (vmcb_is_intercept(&svm->nested.ctl, exit_code))
vmexit = NESTED_EXIT_DONE;
break;
}
case SVM_EXIT_EXCP_BASE ... SVM_EXIT_EXCP_BASE + 0x1f: {
/*
* Host-intercepted exceptions have been checked already in
* nested_svm_exit_special. There is nothing to do here,
* the vmexit is injected by svm_check_nested_events.
*/
vmexit = NESTED_EXIT_DONE;
break;
}
case SVM_EXIT_ERR: {
vmexit = NESTED_EXIT_DONE;
break;
}
default: {
if (vmcb_is_intercept(&svm->nested.ctl, exit_code))
vmexit = NESTED_EXIT_DONE;
}
}
return vmexit;
}
| 0
|
462,224
|
PJ_DEF(pj_status_t) pj_stun_msg_encode(pj_stun_msg *msg,
pj_uint8_t *buf, pj_size_t buf_size,
unsigned options,
const pj_str_t *key,
pj_size_t *p_msg_len)
{
pj_uint8_t *start = buf;
pj_stun_msgint_attr *amsgint = NULL;
pj_stun_fingerprint_attr *afingerprint = NULL;
unsigned printed = 0, body_len;
pj_status_t status;
unsigned i;
PJ_ASSERT_RETURN(msg && buf && buf_size, PJ_EINVAL);
PJ_UNUSED_ARG(options);
PJ_ASSERT_RETURN(options == 0, PJ_EINVAL);
/* Copy the message header part and convert the header fields to
* network byte order
*/
if (buf_size < sizeof(pj_stun_msg_hdr))
return PJ_ETOOSMALL;
PUTVAL16H(buf, 0, msg->hdr.type);
PUTVAL16H(buf, 2, 0); /* length will be calculated later */
PUTVAL32H(buf, 4, msg->hdr.magic);
pj_memcpy(buf+8, msg->hdr.tsx_id, sizeof(msg->hdr.tsx_id));
buf += sizeof(pj_stun_msg_hdr);
buf_size -= sizeof(pj_stun_msg_hdr);
/* Encode each attribute to the message */
for (i=0; i<msg->attr_count; ++i) {
const struct attr_desc *adesc;
const pj_stun_attr_hdr *attr_hdr = msg->attr[i];
if (attr_hdr->type == PJ_STUN_ATTR_MESSAGE_INTEGRITY) {
pj_assert(amsgint == NULL);
amsgint = (pj_stun_msgint_attr*) attr_hdr;
/* Stop when encountering MESSAGE-INTEGRITY */
break;
} else if (attr_hdr->type == PJ_STUN_ATTR_FINGERPRINT) {
afingerprint = (pj_stun_fingerprint_attr*) attr_hdr;
break;
}
adesc = find_attr_desc(attr_hdr->type);
if (adesc) {
status = adesc->encode_attr(attr_hdr, buf, (unsigned)buf_size,
&msg->hdr, &printed);
} else {
/* This may be a generic attribute */
const pj_stun_binary_attr *bin_attr = (const pj_stun_binary_attr*)
attr_hdr;
PJ_ASSERT_RETURN(bin_attr->magic == PJ_STUN_MAGIC, PJ_EBUG);
status = encode_binary_attr(bin_attr, buf, (unsigned)buf_size,
&msg->hdr, &printed);
}
if (status != PJ_SUCCESS)
return status;
buf += printed;
buf_size -= printed;
}
/* We may have stopped printing attribute because we found
* MESSAGE-INTEGRITY or FINGERPRINT. Scan the rest of the
* attributes.
*/
for ( ++i; i<msg->attr_count; ++i) {
const pj_stun_attr_hdr *attr_hdr = msg->attr[i];
/* There mustn't any attribute after FINGERPRINT */
PJ_ASSERT_RETURN(afingerprint == NULL, PJNATH_ESTUNFINGERPOS);
if (attr_hdr->type == PJ_STUN_ATTR_MESSAGE_INTEGRITY) {
/* There mustn't be MESSAGE-INTEGRITY before */
PJ_ASSERT_RETURN(amsgint == NULL,
PJNATH_ESTUNMSGINTPOS);
amsgint = (pj_stun_msgint_attr*) attr_hdr;
} else if (attr_hdr->type == PJ_STUN_ATTR_FINGERPRINT) {
afingerprint = (pj_stun_fingerprint_attr*) attr_hdr;
}
}
#if PJ_STUN_OLD_STYLE_MI_FINGERPRINT
/*
* This is the old style MESSAGE-INTEGRITY and FINGERPRINT
* calculation, used in rfc3489bis-06 and older.
*/
/* We MUST update the message length in the header NOW before
* calculating MESSAGE-INTEGRITY and FINGERPRINT.
* Note that length is not including the 20 bytes header.
*/
if (amsgint && afingerprint) {
body_len = (pj_uint16_t)((buf - start) - 20 + 24 + 8);
} else if (amsgint) {
body_len = (pj_uint16_t)((buf - start) - 20 + 24);
} else if (afingerprint) {
body_len = (pj_uint16_t)((buf - start) - 20 + 8);
} else {
body_len = (pj_uint16_t)((buf - start) - 20);
}
#else
/* If MESSAGE-INTEGRITY is present, include the M-I attribute
* in message length before calculating M-I
*/
if (amsgint) {
body_len = (pj_uint16_t)((buf - start) - 20 + 24);
} else {
body_len = (pj_uint16_t)((buf - start) - 20);
}
#endif /* PJ_STUN_OLD_STYLE_MI_FINGERPRINT */
/* hdr->length = pj_htons(length); */
PUTVAL16H(start, 2, (pj_uint16_t)body_len);
/* Calculate message integrity, if present */
if (amsgint != NULL) {
pj_hmac_sha1_context ctx;
/* Key MUST be specified */
PJ_ASSERT_RETURN(key, PJ_EINVALIDOP);
/* MESSAGE-INTEGRITY must be the last attribute in the message, or
* the last attribute before FINGERPRINT.
*/
if (msg->attr_count>1 && i < msg->attr_count-2) {
/* Should not happen for message generated by us */
pj_assert(PJ_FALSE);
return PJNATH_ESTUNMSGINTPOS;
} else if (i == msg->attr_count-2) {
if (msg->attr[i+1]->type != PJ_STUN_ATTR_FINGERPRINT) {
/* Should not happen for message generated by us */
pj_assert(PJ_FALSE);
return PJNATH_ESTUNMSGINTPOS;
} else {
afingerprint = (pj_stun_fingerprint_attr*) msg->attr[i+1];
}
}
/* Calculate HMAC-SHA1 digest, add zero padding to input
* if necessary to make the input 64 bytes aligned.
*/
pj_hmac_sha1_init(&ctx, (const pj_uint8_t*)key->ptr,
(unsigned)key->slen);
pj_hmac_sha1_update(&ctx, (const pj_uint8_t*)start,
(unsigned)(buf-start));
#if PJ_STUN_OLD_STYLE_MI_FINGERPRINT
// These are obsoleted in rfc3489bis-08
if ((buf-start) & 0x3F) {
pj_uint8_t zeroes[64];
pj_bzero(zeroes, sizeof(zeroes));
pj_hmac_sha1_update(&ctx, zeroes, 64-((buf-start) & 0x3F));
}
#endif /* PJ_STUN_OLD_STYLE_MI_FINGERPRINT */
pj_hmac_sha1_final(&ctx, amsgint->hmac);
/* Put this attribute in the message */
status = encode_msgint_attr(amsgint, buf, (unsigned)buf_size,
&msg->hdr, &printed);
if (status != PJ_SUCCESS)
return status;
buf += printed;
buf_size -= printed;
}
/* Calculate FINGERPRINT if present */
if (afingerprint != NULL) {
#if !PJ_STUN_OLD_STYLE_MI_FINGERPRINT
/* Update message length */
PUTVAL16H(start, 2,
(pj_uint16_t)(GETVAL16H(start, 2)+8));
#endif
afingerprint->value = pj_crc32_calc(start, buf-start);
afingerprint->value ^= STUN_XOR_FINGERPRINT;
/* Put this attribute in the message */
status = encode_uint_attr(afingerprint, buf, (unsigned)buf_size,
&msg->hdr, &printed);
if (status != PJ_SUCCESS)
return status;
buf += printed;
buf_size -= printed;
}
/* Update message length. */
msg->hdr.length = (pj_uint16_t) ((buf - start) - 20);
/* Return the length */
if (p_msg_len)
*p_msg_len = (buf - start);
return PJ_SUCCESS;
}
| 0
|
337,799
|
static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
struct sctp_paramhdr *param,
const struct sctp_chunk *chunk,
struct sctp_chunk **errp)
{
/* This is a fatal error. Any accumulated non-fatal errors are
* not reported.
*/
if (*errp)
sctp_chunk_free(*errp);
/* Create an error chunk and fill it in with our payload. */
*errp = sctp_make_violation_paramlen(asoc, chunk, param);
return 0;
}
| 0
|
222,874
|
bool IsEnqueue(const NodeDef& n) {
return (n.op().find("Enqueue") != string::npos &&
n.op().find("EnqueueMany") == string::npos);
}
| 0
|
259,176
|
static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
unsigned int i, entries;
if (c->trak_index < 0) {
av_log(c->fc, AV_LOG_WARNING, "STCO outside TRAK\n");
return 0;
}
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
avio_r8(pb); /* version */
avio_rb24(pb); /* flags */
entries = avio_rb32(pb);
if (!entries)
return 0;
if (sc->chunk_offsets) {
av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicated STCO atom\n");
return 0;
}
av_free(sc->chunk_offsets);
sc->chunk_count = 0;
sc->chunk_offsets = av_malloc_array(entries, sizeof(*sc->chunk_offsets));
if (!sc->chunk_offsets)
return AVERROR(ENOMEM);
sc->chunk_count = entries;
if (atom.type == MKTAG('s','t','c','o'))
for (i = 0; i < entries && !pb->eof_reached; i++)
sc->chunk_offsets[i] = avio_rb32(pb);
else if (atom.type == MKTAG('c','o','6','4'))
for (i = 0; i < entries && !pb->eof_reached; i++)
sc->chunk_offsets[i] = avio_rb64(pb);
else
return AVERROR_INVALIDDATA;
sc->chunk_count = i;
if (pb->eof_reached) {
av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted STCO atom\n");
return AVERROR_EOF;
}
return 0;
}
| 0
|
522,441
|
int flag2str(int flag, char *flag_str) {
if (flag & 0x1)
flag_str[2] = 'E';
if (flag >> 1 & 0x1)
flag_str[1] = 'W';
if (flag >> 2 & 0x1)
flag_str[0] = 'R';
return 0;
}
| 0
|
476,133
|
int usb_string_ids_n(struct usb_composite_dev *c, unsigned n)
{
unsigned next = c->next_string_id;
if (unlikely(n > 254 || (unsigned)next + n > 254))
return -ENODEV;
c->next_string_id += n;
return next + 1;
}
| 0
|
175,771
|
AvailableSpaceQueryTask(
QuotaManager* manager,
scoped_refptr<base::MessageLoopProxy> db_message_loop,
const FilePath& profile_path,
AvailableSpaceCallback* callback)
: QuotaThreadTask(manager, db_message_loop),
profile_path_(profile_path),
space_(-1),
callback_(callback) {}
| 0
|
261,912
|
njs_string_slice(njs_vm_t *vm, njs_value_t *dst,
const njs_string_prop_t *string, const njs_slice_prop_t *slice)
{
njs_string_prop_t prop;
njs_string_slice_string_prop(&prop, string, slice);
if (njs_fast_path(prop.size != 0)) {
return njs_string_new(vm, dst, prop.start, prop.size, prop.length);
}
*dst = njs_string_empty;
return NJS_OK;
}
| 0
|
292,215
|
inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
const message_tags_data *tags_data)
{
char *tim = ctime (&stamp);
session *sess = find_channel (serv, chan);
if (!sess)
sess = serv->server_session;
tim[24] = 0; /* get rid of the \n */
EMIT_SIGNAL_TIMESTAMP (XP_TE_TOPICDATE, sess, chan, nick, tim, NULL, 0,
tags_data->timestamp);
}
| 0
|
261,250
|
int wm_SemUnlock(wm_Sem *s) {
xSemaphoreGive(*s);
return 0;
}
| 0
|
225,904
|
void totl_box_del(GF_Box *s)
{
gf_free((GF_TRPYBox *)s);
}
| 0
|
234,723
|
static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes)
{
struct btrfs_bio *bbio = kzalloc(
/* the size of the btrfs_bio */
sizeof(struct btrfs_bio) +
/* plus the variable array for the stripes */
sizeof(struct btrfs_bio_stripe) * (total_stripes) +
/* plus the variable array for the tgt dev */
sizeof(int) * (real_stripes) +
/*
* plus the raid_map, which includes both the tgt dev
* and the stripes
*/
sizeof(u64) * (total_stripes),
GFP_NOFS|__GFP_NOFAIL);
atomic_set(&bbio->error, 0);
refcount_set(&bbio->refs, 1);
bbio->tgtdev_map = (int *)(bbio->stripes + total_stripes);
bbio->raid_map = (u64 *)(bbio->tgtdev_map + real_stripes);
return bbio;
}
| 0
|
246,451
|
RPVector *r_bin_wasm_get_elements(RBinWasmObj *bin) {
r_return_val_if_fail (bin && bin->g_sections, NULL);
return bin->g_elements? bin->g_elements: parse_unique_subsec_vec_by_id (bin, R_BIN_WASM_SECTION_ELEMENT);
}
| 0
|
281,159
|
void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si)
{
si->incnt = net->xfrm.policy_count[XFRM_POLICY_IN];
si->outcnt = net->xfrm.policy_count[XFRM_POLICY_OUT];
si->fwdcnt = net->xfrm.policy_count[XFRM_POLICY_FWD];
si->inscnt = net->xfrm.policy_count[XFRM_POLICY_IN+XFRM_POLICY_MAX];
si->outscnt = net->xfrm.policy_count[XFRM_POLICY_OUT+XFRM_POLICY_MAX];
si->fwdscnt = net->xfrm.policy_count[XFRM_POLICY_FWD+XFRM_POLICY_MAX];
si->spdhcnt = net->xfrm.policy_idx_hmask;
si->spdhmcnt = xfrm_policy_hashmax;
}
| 0
|
344,774
|
convtime(const char *s)
{
long total, secs, multiplier;
const char *p;
char *endp;
errno = 0;
total = 0;
p = s;
if (p == NULL || *p == '\0')
return -1;
while (*p) {
secs = strtol(p, &endp, 10);
if (p == endp ||
(errno == ERANGE && (secs == INT_MIN || secs == INT_MAX)) ||
secs < 0)
return -1;
multiplier = 1;
switch (*endp++) {
case '\0':
endp--;
break;
case 's':
case 'S':
break;
case 'm':
case 'M':
multiplier = MINUTES;
break;
case 'h':
case 'H':
multiplier = HOURS;
break;
case 'd':
case 'D':
multiplier = DAYS;
break;
case 'w':
case 'W':
multiplier = WEEKS;
break;
default:
return -1;
}
if (secs > INT_MAX / multiplier)
return -1;
secs *= multiplier;
if (total > INT_MAX - secs)
return -1;
total += secs;
if (total < 0)
return -1;
p = endp;
}
return total;
}
| 0
|
369,429
|
static int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
{
const struct io_op_def *def = &io_op_defs[req->opcode];
struct io_ring_ctx *ctx = req->ctx;
struct async_poll *apoll;
struct io_poll_table ipt;
__poll_t mask = EPOLLONESHOT | POLLERR | POLLPRI;
int ret;
if (!def->pollin && !def->pollout)
return IO_APOLL_ABORTED;
if (!file_can_poll(req->file) || (req->flags & REQ_F_POLLED))
return IO_APOLL_ABORTED;
if (def->pollin) {
mask |= POLLIN | POLLRDNORM;
/* If reading from MSG_ERRQUEUE using recvmsg, ignore POLLIN */
if ((req->opcode == IORING_OP_RECVMSG) &&
(req->sr_msg.msg_flags & MSG_ERRQUEUE))
mask &= ~POLLIN;
} else {
mask |= POLLOUT | POLLWRNORM;
}
if (def->poll_exclusive)
mask |= EPOLLEXCLUSIVE;
if (!(issue_flags & IO_URING_F_UNLOCKED) &&
!list_empty(&ctx->apoll_cache)) {
apoll = list_first_entry(&ctx->apoll_cache, struct async_poll,
poll.wait.entry);
list_del_init(&apoll->poll.wait.entry);
} else {
apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
if (unlikely(!apoll))
return IO_APOLL_ABORTED;
}
apoll->double_poll = NULL;
req->apoll = apoll;
req->flags |= REQ_F_POLLED;
ipt.pt._qproc = io_async_queue_proc;
io_kbuf_recycle(req, issue_flags);
ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask);
if (ret || ipt.error)
return ret ? IO_APOLL_READY : IO_APOLL_ABORTED;
trace_io_uring_poll_arm(ctx, req, req->user_data, req->opcode,
mask, apoll->poll.events);
return IO_APOLL_OK;
| 0
|
427,199
|
static int createlabel (LexState *ls, TString *name, int line,
int last) {
FuncState *fs = ls->fs;
Labellist *ll = &ls->dyd->label;
int l = newlabelentry(ls, ll, name, line, luaK_getlabel(fs));
if (last) { /* label is last no-op statement in the block? */
/* assume that locals are already out of scope */
ll->arr[l].nactvar = fs->bl->nactvar;
}
if (solvegotos(ls, &ll->arr[l])) { /* need close? */
luaK_codeABC(fs, OP_CLOSE, luaY_nvarstack(fs), 0, 0);
return 1;
}
return 0;
}
| 0
|
313,834
|
nv_page(cmdarg_T *cap)
{
if (!checkclearop(cap->oap))
{
if (mod_mask & MOD_MASK_CTRL)
{
// <C-PageUp>: tab page back; <C-PageDown>: tab page forward
if (cap->arg == BACKWARD)
goto_tabpage(-(int)cap->count1);
else
goto_tabpage((int)cap->count0);
}
else
(void)onepage(cap->arg, cap->count1);
}
}
| 0
|
391,662
|
static void validate_my_share_entries(struct smbd_server_connection *sconn,
int num,
struct share_mode_entry *share_entry)
{
struct server_id self = messaging_server_id(sconn->msg_ctx);
files_struct *fsp;
if (!serverid_equal(&self, &share_entry->pid)) {
return;
}
if (!is_valid_share_mode_entry(share_entry)) {
return;
}
fsp = file_find_dif(sconn, share_entry->id,
share_entry->share_file_id);
if (!fsp) {
DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
share_mode_str(talloc_tos(), num, share_entry) ));
smb_panic("validate_my_share_entries: Cannot match a "
"share entry with an open file\n");
}
if (((uint16)fsp->oplock_type) != share_entry->op_type) {
goto panic;
}
return;
panic:
{
char *str;
DEBUG(0,("validate_my_share_entries: PANIC : %s\n",
share_mode_str(talloc_tos(), num, share_entry) ));
str = talloc_asprintf(talloc_tos(),
"validate_my_share_entries: "
"file %s, oplock_type = 0x%x, op_type = 0x%x\n",
fsp->fsp_name->base_name,
(unsigned int)fsp->oplock_type,
(unsigned int)share_entry->op_type );
smb_panic(str);
}
}
| 0
|
369,188
|
void __io_uring_free(struct task_struct *tsk)
{
struct io_uring_task *tctx = tsk->io_uring;
WARN_ON_ONCE(!xa_empty(&tctx->xa));
WARN_ON_ONCE(tctx->io_wq);
WARN_ON_ONCE(tctx->cached_refs);
kfree(tctx->registered_rings);
percpu_counter_destroy(&tctx->inflight);
kfree(tctx);
tsk->io_uring = NULL;
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.