idx
int64 | func
string | target
int64 |
|---|---|---|
36,037
|
static int fuse_writepage(struct page *page, struct writeback_control *wbc)
{
int err;
if (fuse_page_is_writeback(page->mapping->host, page->index)) {
/*
* ->writepages() should be called for sync() and friends. We
* should only get here on direct reclaim and then we are
* allowed to skip a page which is already in flight
*/
WARN_ON(wbc->sync_mode == WB_SYNC_ALL);
redirty_page_for_writepage(wbc, page);
return 0;
}
err = fuse_writepage_locked(page);
unlock_page(page);
return err;
}
| 0
|
377,591
|
static void ide_sector_write_cb(void *opaque, int ret)
{
IDEState *s = opaque;
int n;
bdrv_acct_done(s->bs, &s->acct);
s->pio_aiocb = NULL;
s->status &= ~BUSY_STAT;
if (ret != 0) {
if (ide_handle_rw_error(s, -ret, BM_STATUS_PIO_RETRY)) {
return;
}
}
n = s->nsector;
if (n > s->req_nb_sectors) {
n = s->req_nb_sectors;
}
s->nsector -= n;
if (s->nsector == 0) {
/* no more sectors to write */
ide_transfer_stop(s);
} else {
int n1 = s->nsector;
if (n1 > s->req_nb_sectors) {
n1 = s->req_nb_sectors;
}
ide_transfer_start(s, s->io_buffer, n1 * BDRV_SECTOR_SIZE,
ide_sector_write);
}
ide_set_sector(s, ide_get_sector(s) + n);
if (win2k_install_hack && ((++s->irq_count % 16) == 0)) {
/* It seems there is a bug in the Windows 2000 installer HDD
IDE driver which fills the disk with empty logs when the
IDE write IRQ comes too early. This hack tries to correct
that at the expense of slower write performances. Use this
option _only_ to install Windows 2000. You must disable it
for normal use. */
timer_mod(s->sector_write_timer,
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000));
} else {
ide_set_irq(s->bus);
}
}
| 0
|
454,755
|
intrusive_ptr<Expression> ExpressionDateFromString::parse(ExpressionContext* const expCtx,
BSONElement expr,
const VariablesParseState& vps) {
uassert(40540,
str::stream() << "$dateFromString only supports an object as an argument, found: "
<< typeName(expr.type()),
expr.type() == BSONType::Object);
BSONElement dateStringElem, timeZoneElem, formatElem, onNullElem, onErrorElem;
const BSONObj args = expr.embeddedObject();
for (auto&& arg : args) {
auto field = arg.fieldNameStringData();
if (field == "format"_sd) {
formatElem = arg;
} else if (field == "dateString"_sd) {
dateStringElem = arg;
} else if (field == "timezone"_sd) {
timeZoneElem = arg;
} else if (field == "onNull"_sd) {
onNullElem = arg;
} else if (field == "onError"_sd) {
onErrorElem = arg;
} else {
uasserted(40541,
str::stream()
<< "Unrecognized argument to $dateFromString: " << arg.fieldName());
}
}
uassert(40542, "Missing 'dateString' parameter to $dateFromString", dateStringElem);
return new ExpressionDateFromString(
expCtx,
parseOperand(expCtx, dateStringElem, vps),
timeZoneElem ? parseOperand(expCtx, timeZoneElem, vps) : nullptr,
formatElem ? parseOperand(expCtx, formatElem, vps) : nullptr,
onNullElem ? parseOperand(expCtx, onNullElem, vps) : nullptr,
onErrorElem ? parseOperand(expCtx, onErrorElem, vps) : nullptr);
}
| 0
|
4,279
|
ex_substitute(exarg_T *eap)
{
linenr_T lnum;
long i = 0;
regmmatch_T regmatch;
static subflags_T subflags = {FALSE, FALSE, FALSE, TRUE, FALSE,
FALSE, FALSE, 0};
#ifdef FEAT_EVAL
subflags_T subflags_save;
#endif
int save_do_all; // remember user specified 'g' flag
int save_do_ask; // remember user specified 'c' flag
char_u *pat = NULL, *sub = NULL; // init for GCC
int delimiter;
int sublen;
int got_quit = FALSE;
int got_match = FALSE;
int temp;
int which_pat;
char_u *cmd;
int save_State;
linenr_T first_line = 0; // first changed line
linenr_T last_line= 0; // below last changed line AFTER the
// change
linenr_T old_line_count = curbuf->b_ml.ml_line_count;
linenr_T line2;
long nmatch; // number of lines in match
char_u *sub_firstline; // allocated copy of first sub line
int endcolumn = FALSE; // cursor in last column when done
pos_T old_cursor = curwin->w_cursor;
int start_nsubs;
#ifdef FEAT_EVAL
int save_ma = 0;
#endif
cmd = eap->arg;
if (!global_busy)
{
sub_nsubs = 0;
sub_nlines = 0;
}
start_nsubs = sub_nsubs;
if (eap->cmdidx == CMD_tilde)
which_pat = RE_LAST; // use last used regexp
else
which_pat = RE_SUBST; // use last substitute regexp
// new pattern and substitution
if (eap->cmd[0] == 's' && *cmd != NUL && !VIM_ISWHITE(*cmd)
&& vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL)
{
// don't accept alphanumeric for separator
if (check_regexp_delim(*cmd) == FAIL)
return;
#ifdef FEAT_EVAL
if (in_vim9script() && check_global_and_subst(eap->cmd, eap->arg)
== FAIL)
return;
#endif
/*
* undocumented vi feature:
* "\/sub/" and "\?sub?" use last used search pattern (almost like
* //sub/r). "\&sub&" use last substitute pattern (like //sub/).
*/
if (*cmd == '\\')
{
++cmd;
if (vim_strchr((char_u *)"/?&", *cmd) == NULL)
{
emsg(_(e_backslash_should_be_followed_by));
return;
}
if (*cmd != '&')
which_pat = RE_SEARCH; // use last '/' pattern
pat = (char_u *)""; // empty search pattern
delimiter = *cmd++; // remember delimiter character
}
else // find the end of the regexp
{
which_pat = RE_LAST; // use last used regexp
delimiter = *cmd++; // remember delimiter character
pat = cmd; // remember start of search pat
cmd = skip_regexp_ex(cmd, delimiter, magic_isset(),
&eap->arg, NULL, NULL);
if (cmd[0] == delimiter) // end delimiter found
*cmd++ = NUL; // replace it with a NUL
}
/*
* Small incompatibility: vi sees '\n' as end of the command, but in
* Vim we want to use '\n' to find/substitute a NUL.
*/
sub = cmd; // remember the start of the substitution
cmd = skip_substitute(cmd, delimiter);
if (!eap->skip)
{
// In POSIX vi ":s/pat/%/" uses the previous subst. string.
if (STRCMP(sub, "%") == 0
&& vim_strchr(p_cpo, CPO_SUBPERCENT) != NULL)
{
if (old_sub == NULL) // there is no previous command
{
emsg(_(e_no_previous_substitute_regular_expression));
return;
}
sub = old_sub;
}
else
{
vim_free(old_sub);
old_sub = vim_strsave(sub);
}
}
}
else if (!eap->skip) // use previous pattern and substitution
{
if (old_sub == NULL) // there is no previous command
{
emsg(_(e_no_previous_substitute_regular_expression));
return;
}
pat = NULL; // search_regcomp() will use previous pattern
sub = old_sub;
// Vi compatibility quirk: repeating with ":s" keeps the cursor in the
// last column after using "$".
endcolumn = (curwin->w_curswant == MAXCOL);
}
// Recognize ":%s/\n//" and turn it into a join command, which is much
// more efficient.
// TODO: find a generic solution to make line-joining operations more
// efficient, avoid allocating a string that grows in size.
if (pat != NULL && STRCMP(pat, "\\n") == 0
&& *sub == NUL
&& (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l'
|| *cmd == 'p' || *cmd == '#'))))
{
linenr_T joined_lines_count;
if (eap->skip)
return;
curwin->w_cursor.lnum = eap->line1;
if (*cmd == 'l')
eap->flags = EXFLAG_LIST;
else if (*cmd == '#')
eap->flags = EXFLAG_NR;
else if (*cmd == 'p')
eap->flags = EXFLAG_PRINT;
// The number of lines joined is the number of lines in the range plus
// one. One less when the last line is included.
joined_lines_count = eap->line2 - eap->line1 + 1;
if (eap->line2 < curbuf->b_ml.ml_line_count)
++joined_lines_count;
if (joined_lines_count > 1)
{
(void)do_join(joined_lines_count, FALSE, TRUE, FALSE, TRUE);
sub_nsubs = joined_lines_count - 1;
sub_nlines = 1;
(void)do_sub_msg(FALSE);
ex_may_print(eap);
}
if ((cmdmod.cmod_flags & CMOD_KEEPPATTERNS) == 0)
save_re_pat(RE_SUBST, pat, magic_isset());
// put pattern in history
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
return;
}
/*
* Find trailing options. When '&' is used, keep old options.
*/
if (*cmd == '&')
++cmd;
else
{
#ifdef FEAT_EVAL
if (in_vim9script())
{
// ignore 'gdefault' and 'edcompatible'
subflags.do_all = FALSE;
subflags.do_ask = FALSE;
}
else
#endif
if (!p_ed)
{
if (p_gd) // default is global on
subflags.do_all = TRUE;
else
subflags.do_all = FALSE;
subflags.do_ask = FALSE;
}
subflags.do_error = TRUE;
subflags.do_print = FALSE;
subflags.do_list = FALSE;
subflags.do_count = FALSE;
subflags.do_number = FALSE;
subflags.do_ic = 0;
}
while (*cmd)
{
/*
* Note that 'g' and 'c' are always inverted, also when p_ed is off.
* 'r' is never inverted.
*/
if (*cmd == 'g')
subflags.do_all = !subflags.do_all;
else if (*cmd == 'c')
subflags.do_ask = !subflags.do_ask;
else if (*cmd == 'n')
subflags.do_count = TRUE;
else if (*cmd == 'e')
subflags.do_error = !subflags.do_error;
else if (*cmd == 'r') // use last used regexp
which_pat = RE_LAST;
else if (*cmd == 'p')
subflags.do_print = TRUE;
else if (*cmd == '#')
{
subflags.do_print = TRUE;
subflags.do_number = TRUE;
}
else if (*cmd == 'l')
{
subflags.do_print = TRUE;
subflags.do_list = TRUE;
}
else if (*cmd == 'i') // ignore case
subflags.do_ic = 'i';
else if (*cmd == 'I') // don't ignore case
subflags.do_ic = 'I';
else
break;
++cmd;
}
if (subflags.do_count)
subflags.do_ask = FALSE;
save_do_all = subflags.do_all;
save_do_ask = subflags.do_ask;
/*
* check for a trailing count
*/
cmd = skipwhite(cmd);
if (VIM_ISDIGIT(*cmd))
{
i = getdigits(&cmd);
if (i <= 0 && !eap->skip && subflags.do_error)
{
emsg(_(e_positive_count_required));
return;
}
eap->line1 = eap->line2;
eap->line2 += i - 1;
if (eap->line2 > curbuf->b_ml.ml_line_count)
eap->line2 = curbuf->b_ml.ml_line_count;
}
/*
* check for trailing command or garbage
*/
cmd = skipwhite(cmd);
if (*cmd && *cmd != '"') // if not end-of-line or comment
{
set_nextcmd(eap, cmd);
if (eap->nextcmd == NULL)
{
semsg(_(e_trailing_characters_str), cmd);
return;
}
}
if (eap->skip) // not executing commands, only parsing
return;
if (!subflags.do_count && !curbuf->b_p_ma)
{
// Substitution is not allowed in non-'modifiable' buffer
emsg(_(e_cannot_make_changes_modifiable_is_off));
return;
}
if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, ®match) == FAIL)
{
if (subflags.do_error)
emsg(_(e_invalid_command));
return;
}
// the 'i' or 'I' flag overrules 'ignorecase' and 'smartcase'
if (subflags.do_ic == 'i')
regmatch.rmm_ic = TRUE;
else if (subflags.do_ic == 'I')
regmatch.rmm_ic = FALSE;
sub_firstline = NULL;
/*
* ~ in the substitute pattern is replaced with the old pattern.
* We do it here once to avoid it to be replaced over and over again.
* But don't do it when it starts with "\=", then it's an expression.
*/
if (!(sub[0] == '\\' && sub[1] == '='))
sub = regtilde(sub, magic_isset());
/*
* Check for a match on each line.
*/
line2 = eap->line2;
for (lnum = eap->line1; lnum <= line2 && !(got_quit
#if defined(FEAT_EVAL)
|| aborting()
#endif
); ++lnum)
{
nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum,
(colnr_T)0, NULL, NULL);
if (nmatch)
{
colnr_T copycol;
colnr_T matchcol;
colnr_T prev_matchcol = MAXCOL;
char_u *new_end, *new_start = NULL;
unsigned new_start_len = 0;
char_u *p1;
int did_sub = FALSE;
int lastone;
int len, copy_len, needed_len;
long nmatch_tl = 0; // nr of lines matched below lnum
int do_again; // do it again after joining lines
int skip_match = FALSE;
linenr_T sub_firstlnum; // nr of first sub line
#ifdef FEAT_PROP_POPUP
int apc_flags = APC_SAVE_FOR_UNDO | APC_SUBSTITUTE;
colnr_T total_added = 0;
#endif
/*
* The new text is build up step by step, to avoid too much
* copying. There are these pieces:
* sub_firstline The old text, unmodified.
* copycol Column in the old text where we started
* looking for a match; from here old text still
* needs to be copied to the new text.
* matchcol Column number of the old text where to look
* for the next match. It's just after the
* previous match or one further.
* prev_matchcol Column just after the previous match (if any).
* Mostly equal to matchcol, except for the first
* match and after skipping an empty match.
* regmatch.*pos Where the pattern matched in the old text.
* new_start The new text, all that has been produced so
* far.
* new_end The new text, where to append new text.
*
* lnum The line number where we found the start of
* the match. Can be below the line we searched
* when there is a \n before a \zs in the
* pattern.
* sub_firstlnum The line number in the buffer where to look
* for a match. Can be different from "lnum"
* when the pattern or substitute string contains
* line breaks.
*
* Special situations:
* - When the substitute string contains a line break, the part up
* to the line break is inserted in the text, but the copy of
* the original line is kept. "sub_firstlnum" is adjusted for
* the inserted lines.
* - When the matched pattern contains a line break, the old line
* is taken from the line at the end of the pattern. The lines
* in the match are deleted later, "sub_firstlnum" is adjusted
* accordingly.
*
* The new text is built up in new_start[]. It has some extra
* room to avoid using alloc()/free() too often. new_start_len is
* the length of the allocated memory at new_start.
*
* Make a copy of the old line, so it won't be taken away when
* updating the screen or handling a multi-line match. The "old_"
* pointers point into this copy.
*/
sub_firstlnum = lnum;
copycol = 0;
matchcol = 0;
// At first match, remember current cursor position.
if (!got_match)
{
setpcmark();
got_match = TRUE;
}
/*
* Loop until nothing more to replace in this line.
* 1. Handle match with empty string.
* 2. If do_ask is set, ask for confirmation.
* 3. substitute the string.
* 4. if do_all is set, find next match
* 5. break if there isn't another match in this line
*/
for (;;)
{
// Advance "lnum" to the line where the match starts. The
// match does not start in the first line when there is a line
// break before \zs.
if (regmatch.startpos[0].lnum > 0)
{
lnum += regmatch.startpos[0].lnum;
sub_firstlnum += regmatch.startpos[0].lnum;
nmatch -= regmatch.startpos[0].lnum;
VIM_CLEAR(sub_firstline);
}
// Match might be after the last line for "\n\zs" matching at
// the end of the last line.
if (lnum > curbuf->b_ml.ml_line_count)
break;
if (sub_firstline == NULL)
{
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
if (sub_firstline == NULL)
{
vim_free(new_start);
goto outofmem;
}
}
// Save the line number of the last change for the final
// cursor position (just like Vi).
curwin->w_cursor.lnum = lnum;
do_again = FALSE;
/*
* 1. Match empty string does not count, except for first
* match. This reproduces the strange vi behaviour.
* This also catches endless loops.
*/
if (matchcol == prev_matchcol
&& regmatch.endpos[0].lnum == 0
&& matchcol == regmatch.endpos[0].col)
{
if (sub_firstline[matchcol] == NUL)
// We already were at the end of the line. Don't look
// for a match in this line again.
skip_match = TRUE;
else
{
// search for a match at next column
if (has_mbyte)
matchcol += mb_ptr2len(sub_firstline + matchcol);
else
++matchcol;
}
goto skip;
}
// Normally we continue searching for a match just after the
// previous match.
matchcol = regmatch.endpos[0].col;
prev_matchcol = matchcol;
/*
* 2. If do_count is set only increase the counter.
* If do_ask is set, ask for confirmation.
*/
if (subflags.do_count)
{
// For a multi-line match, put matchcol at the NUL at
// the end of the line and set nmatch to one, so that
// we continue looking for a match on the next line.
// Avoids that ":s/\nB\@=//gc" get stuck.
if (nmatch > 1)
{
matchcol = (colnr_T)STRLEN(sub_firstline);
nmatch = 1;
skip_match = TRUE;
}
sub_nsubs++;
did_sub = TRUE;
#ifdef FEAT_EVAL
// Skip the substitution, unless an expression is used,
// then it is evaluated in the sandbox.
if (!(sub[0] == '\\' && sub[1] == '='))
#endif
goto skip;
}
if (subflags.do_ask)
{
int typed = 0;
// change State to CONFIRM, so that the mouse works
// properly
save_State = State;
State = CONFIRM;
setmouse(); // disable mouse in xterm
curwin->w_cursor.col = regmatch.startpos[0].col;
if (curwin->w_p_crb)
do_check_cursorbind();
// When 'cpoptions' contains "u" don't sync undo when
// asking for confirmation.
if (vim_strchr(p_cpo, CPO_UNDO) != NULL)
++no_u_sync;
/*
* Loop until 'y', 'n', 'q', CTRL-E or CTRL-Y typed.
*/
while (subflags.do_ask)
{
if (exmode_active)
{
char_u *resp;
colnr_T sc, ec;
print_line_no_prefix(lnum,
subflags.do_number, subflags.do_list);
getvcol(curwin, &curwin->w_cursor, &sc, NULL, NULL);
curwin->w_cursor.col = regmatch.endpos[0].col - 1;
if (curwin->w_cursor.col < 0)
curwin->w_cursor.col = 0;
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec);
curwin->w_cursor.col = regmatch.startpos[0].col;
if (subflags.do_number || curwin->w_p_nu)
{
int numw = number_width(curwin) + 1;
sc += numw;
ec += numw;
}
msg_start();
for (i = 0; i < (long)sc; ++i)
msg_putchar(' ');
for ( ; i <= (long)ec; ++i)
msg_putchar('^');
resp = getexmodeline('?', NULL, 0, TRUE);
if (resp != NULL)
{
typed = *resp;
vim_free(resp);
}
}
else
{
char_u *orig_line = NULL;
int len_change = 0;
int save_p_lz = p_lz;
#ifdef FEAT_FOLDING
int save_p_fen = curwin->w_p_fen;
curwin->w_p_fen = FALSE;
#endif
// Invert the matched string.
// Remove the inversion afterwards.
temp = RedrawingDisabled;
RedrawingDisabled = 0;
// avoid calling update_screen() in vgetorpeek()
p_lz = FALSE;
if (new_start != NULL)
{
// There already was a substitution, we would
// like to show this to the user. We cannot
// really update the line, it would change
// what matches. Temporarily replace the line
// and change it back afterwards.
orig_line = vim_strsave(ml_get(lnum));
if (orig_line != NULL)
{
char_u *new_line = concat_str(new_start,
sub_firstline + copycol);
if (new_line == NULL)
VIM_CLEAR(orig_line);
else
{
// Position the cursor relative to the
// end of the line, the previous
// substitute may have inserted or
// deleted characters before the
// cursor.
len_change = (int)STRLEN(new_line)
- (int)STRLEN(orig_line);
curwin->w_cursor.col += len_change;
ml_replace(lnum, new_line, FALSE);
}
}
}
search_match_lines = regmatch.endpos[0].lnum
- regmatch.startpos[0].lnum;
search_match_endcol = regmatch.endpos[0].col
+ len_change;
highlight_match = TRUE;
update_topline();
validate_cursor();
update_screen(SOME_VALID);
highlight_match = FALSE;
redraw_later(SOME_VALID);
#ifdef FEAT_FOLDING
curwin->w_p_fen = save_p_fen;
#endif
if (msg_row == Rows - 1)
msg_didout = FALSE; // avoid a scroll-up
msg_starthere();
i = msg_scroll;
msg_scroll = 0; // truncate msg when
// needed
msg_no_more = TRUE;
// write message same highlighting as for
// wait_return
smsg_attr(HL_ATTR(HLF_R),
_("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
msg_no_more = FALSE;
msg_scroll = i;
showruler(TRUE);
windgoto(msg_row, msg_col);
RedrawingDisabled = temp;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = FALSE; // allow scrolling here
#endif
++no_mapping; // don't map this key
++allow_keys; // allow special keys
typed = plain_vgetc();
--allow_keys;
--no_mapping;
// clear the question
msg_didout = FALSE; // don't scroll up
msg_col = 0;
gotocmdline(TRUE);
p_lz = save_p_lz;
// restore the line
if (orig_line != NULL)
ml_replace(lnum, orig_line, FALSE);
}
need_wait_return = FALSE; // no hit-return prompt
if (typed == 'q' || typed == ESC || typed == Ctrl_C
#ifdef UNIX
|| typed == intr_char
#endif
)
{
got_quit = TRUE;
break;
}
if (typed == 'n')
break;
if (typed == 'y')
break;
if (typed == 'l')
{
// last: replace and then stop
subflags.do_all = FALSE;
line2 = lnum;
break;
}
if (typed == 'a')
{
subflags.do_ask = FALSE;
break;
}
if (typed == Ctrl_E)
scrollup_clamp();
else if (typed == Ctrl_Y)
scrolldown_clamp();
}
State = save_State;
setmouse();
if (vim_strchr(p_cpo, CPO_UNDO) != NULL)
--no_u_sync;
if (typed == 'n')
{
// For a multi-line match, put matchcol at the NUL at
// the end of the line and set nmatch to one, so that
// we continue looking for a match on the next line.
// Avoids that ":%s/\nB\@=//gc" and ":%s/\n/,\r/gc"
// get stuck when pressing 'n'.
if (nmatch > 1)
{
matchcol = (colnr_T)STRLEN(sub_firstline);
skip_match = TRUE;
}
goto skip;
}
if (got_quit)
goto skip;
}
// Move the cursor to the start of the match, so that we can
// use "\=col(".").
curwin->w_cursor.col = regmatch.startpos[0].col;
/*
* 3. substitute the string.
*/
#ifdef FEAT_EVAL
save_ma = curbuf->b_p_ma;
if (subflags.do_count)
{
// prevent accidentally changing the buffer by a function
curbuf->b_p_ma = FALSE;
sandbox++;
}
// Save flags for recursion. They can change for e.g.
// :s/^/\=execute("s#^##gn")
subflags_save = subflags;
#endif
// get length of substitution part
sublen = vim_regsub_multi(®match,
sub_firstlnum - regmatch.startpos[0].lnum,
sub, sub_firstline, FALSE, magic_isset(), TRUE);
#ifdef FEAT_EVAL
// If getting the substitute string caused an error, don't do
// the replacement.
// Don't keep flags set by a recursive call.
subflags = subflags_save;
if (aborting() || subflags.do_count)
{
curbuf->b_p_ma = save_ma;
if (sandbox > 0)
sandbox--;
goto skip;
}
#endif
// When the match included the "$" of the last line it may
// go beyond the last line of the buffer.
if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1)
{
nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1;
skip_match = TRUE;
}
// Need room for:
// - result so far in new_start (not for first sub in line)
// - original text up to match
// - length of substituted part
// - original text after match
// Adjust text properties here, since we have all information
// needed.
if (nmatch == 1)
{
p1 = sub_firstline;
#ifdef FEAT_PROP_POPUP
if (curbuf->b_has_textprop)
{
int bytes_added = sublen - 1 - (regmatch.endpos[0].col
- regmatch.startpos[0].col);
// When text properties are changed, need to save for
// undo first, unless done already.
if (adjust_prop_columns(lnum,
total_added + regmatch.startpos[0].col,
bytes_added, apc_flags))
apc_flags &= ~APC_SAVE_FOR_UNDO;
// Offset for column byte number of the text property
// in the resulting buffer afterwards.
total_added += bytes_added;
}
#endif
}
else
{
p1 = ml_get(sub_firstlnum + nmatch - 1);
nmatch_tl += nmatch - 1;
}
copy_len = regmatch.startpos[0].col - copycol;
needed_len = copy_len + ((unsigned)STRLEN(p1)
- regmatch.endpos[0].col) + sublen + 1;
if (new_start == NULL)
{
/*
* Get some space for a temporary buffer to do the
* substitution into (and some extra space to avoid
* too many calls to alloc()/free()).
*/
new_start_len = needed_len + 50;
if ((new_start = alloc(new_start_len)) == NULL)
goto outofmem;
*new_start = NUL;
new_end = new_start;
}
else
{
/*
* Check if the temporary buffer is long enough to do the
* substitution into. If not, make it larger (with a bit
* extra to avoid too many calls to alloc()/free()).
*/
len = (unsigned)STRLEN(new_start);
needed_len += len;
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
if ((p1 = alloc(new_start_len)) == NULL)
{
vim_free(new_start);
goto outofmem;
}
mch_memmove(p1, new_start, (size_t)(len + 1));
vim_free(new_start);
new_start = p1;
}
new_end = new_start + len;
}
/*
* copy the text up to the part that matched
*/
mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
new_end += copy_len;
(void)vim_regsub_multi(®match,
sub_firstlnum - regmatch.startpos[0].lnum,
sub, new_end, TRUE, magic_isset(), TRUE);
sub_nsubs++;
did_sub = TRUE;
// Move the cursor to the start of the line, to avoid that it
// is beyond the end of the line after the substitution.
curwin->w_cursor.col = 0;
// For a multi-line match, make a copy of the last matched
// line and continue in that one.
if (nmatch > 1)
{
sub_firstlnum += nmatch - 1;
vim_free(sub_firstline);
sub_firstline = vim_strsave(ml_get(sub_firstlnum));
// When going beyond the last line, stop substituting.
if (sub_firstlnum <= line2)
do_again = TRUE;
else
subflags.do_all = FALSE;
}
// Remember next character to be copied.
copycol = regmatch.endpos[0].col;
if (skip_match)
{
// Already hit end of the buffer, sub_firstlnum is one
// less than what it ought to be.
vim_free(sub_firstline);
sub_firstline = vim_strsave((char_u *)"");
copycol = 0;
}
/*
* Now the trick is to replace CTRL-M chars with a real line
* break. This would make it impossible to insert a CTRL-M in
* the text. The line break can be avoided by preceding the
* CTRL-M with a backslash. To be able to insert a backslash,
* they must be doubled in the string and are halved here.
* That is Vi compatible.
*/
for (p1 = new_end; *p1; ++p1)
{
if (p1[0] == '\\' && p1[1] != NUL) // remove backslash
{
STRMOVE(p1, p1 + 1);
#ifdef FEAT_PROP_POPUP
if (curbuf->b_has_textprop)
{
// When text properties are changed, need to save
// for undo first, unless done already.
if (adjust_prop_columns(lnum,
(colnr_T)(p1 - new_start), -1,
apc_flags))
apc_flags &= ~APC_SAVE_FOR_UNDO;
}
#endif
}
else if (*p1 == CAR)
{
if (u_inssub(lnum) == OK) // prepare for undo
{
colnr_T plen = (colnr_T)(p1 - new_start + 1);
*p1 = NUL; // truncate up to the CR
ml_append(lnum - 1, new_start, plen, FALSE);
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
if (subflags.do_ask)
appended_lines(lnum - 1, 1L);
else
{
if (first_line == 0)
first_line = lnum;
last_line = lnum + 1;
}
#ifdef FEAT_PROP_POPUP
adjust_props_for_split(lnum + 1, lnum, plen, 1);
#endif
// all line numbers increase
++sub_firstlnum;
++lnum;
++line2;
// move the cursor to the new line, like Vi
++curwin->w_cursor.lnum;
// copy the rest
STRMOVE(new_start, p1 + 1);
p1 = new_start - 1;
}
}
else if (has_mbyte)
p1 += (*mb_ptr2len)(p1) - 1;
}
/*
* 4. If do_all is set, find next match.
* Prevent endless loop with patterns that match empty
* strings, e.g. :s/$/pat/g or :s/[a-z]* /(&)/g.
* But ":s/\n/#/" is OK.
*/
skip:
// We already know that we did the last subst when we are at
// the end of the line, except that a pattern like
// "bar\|\nfoo" may match at the NUL. "lnum" can be below
// "line2" when there is a \zs in the pattern after a line
// break.
lastone = (skip_match
|| got_int
|| got_quit
|| lnum > line2
|| !(subflags.do_all || do_again)
|| (sub_firstline[matchcol] == NUL && nmatch <= 1
&& !re_multiline(regmatch.regprog)));
nmatch = -1;
/*
* Replace the line in the buffer when needed. This is
* skipped when there are more matches.
* The check for nmatch_tl is needed for when multi-line
* matching must replace the lines before trying to do another
* match, otherwise "\@<=" won't work.
* When the match starts below where we start searching also
* need to replace the line first (using \zs after \n).
*/
if (lastone
|| nmatch_tl > 0
|| (nmatch = vim_regexec_multi(®match, curwin,
curbuf, sub_firstlnum,
matchcol, NULL, NULL)) == 0
|| regmatch.startpos[0].lnum > 0)
{
if (new_start != NULL)
{
/*
* Copy the rest of the line, that didn't match.
* "matchcol" has to be adjusted, we use the end of
* the line as reference, because the substitute may
* have changed the number of characters. Same for
* "prev_matchcol".
*/
STRCAT(new_start, sub_firstline + copycol);
matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol;
prev_matchcol = (colnr_T)STRLEN(sub_firstline)
- prev_matchcol;
if (u_savesub(lnum) != OK)
break;
ml_replace(lnum, new_start, TRUE);
if (nmatch_tl > 0)
{
/*
* Matched lines have now been substituted and are
* useless, delete them. The part after the match
* has been appended to new_start, we don't need
* it in the buffer.
*/
++lnum;
if (u_savedel(lnum, nmatch_tl) != OK)
break;
for (i = 0; i < nmatch_tl; ++i)
ml_delete(lnum);
mark_adjust(lnum, lnum + nmatch_tl - 1,
(long)MAXLNUM, -nmatch_tl);
if (subflags.do_ask)
deleted_lines(lnum, nmatch_tl);
--lnum;
line2 -= nmatch_tl; // nr of lines decreases
nmatch_tl = 0;
}
// When asking, undo is saved each time, must also set
// changed flag each time.
if (subflags.do_ask)
changed_bytes(lnum, 0);
else
{
if (first_line == 0)
first_line = lnum;
last_line = lnum + 1;
}
sub_firstlnum = lnum;
vim_free(sub_firstline); // free the temp buffer
sub_firstline = new_start;
new_start = NULL;
matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol;
prev_matchcol = (colnr_T)STRLEN(sub_firstline)
- prev_matchcol;
copycol = 0;
}
if (nmatch == -1 && !lastone)
nmatch = vim_regexec_multi(®match, curwin, curbuf,
sub_firstlnum, matchcol, NULL, NULL);
/*
* 5. break if there isn't another match in this line
*/
if (nmatch <= 0)
{
// If the match found didn't start where we were
// searching, do the next search in the line where we
// found the match.
if (nmatch == -1)
lnum -= regmatch.startpos[0].lnum;
break;
}
}
line_breakcheck();
}
if (did_sub)
++sub_nlines;
vim_free(new_start); // for when substitute was cancelled
VIM_CLEAR(sub_firstline); // free the copy of the original line
}
line_breakcheck();
}
if (first_line != 0)
{
// Need to subtract the number of added lines from "last_line" to get
// the line number before the change (same as adding the number of
// deleted lines).
i = curbuf->b_ml.ml_line_count - old_line_count;
changed_lines(first_line, 0, last_line - i, i);
}
outofmem:
vim_free(sub_firstline); // may have to free allocated copy of the line
// ":s/pat//n" doesn't move the cursor
if (subflags.do_count)
curwin->w_cursor = old_cursor;
if (sub_nsubs > start_nsubs)
{
if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set the '[ and '] marks.
curbuf->b_op_start.lnum = eap->line1;
curbuf->b_op_end.lnum = line2;
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
}
if (!global_busy)
{
// when interactive leave cursor on the match
if (!subflags.do_ask)
{
if (endcolumn)
coladvance((colnr_T)MAXCOL);
else
beginline(BL_WHITE | BL_FIX);
}
if (!do_sub_msg(subflags.do_count) && subflags.do_ask)
msg("");
}
else
global_need_beginline = TRUE;
if (subflags.do_print)
print_line(curwin->w_cursor.lnum,
subflags.do_number, subflags.do_list);
}
else if (!global_busy)
{
if (got_int) // interrupted
emsg(_(e_interrupted));
else if (got_match) // did find something but nothing substituted
msg("");
else if (subflags.do_error) // nothing found
semsg(_(e_pattern_not_found_str), get_search_pat());
}
#ifdef FEAT_FOLDING
if (subflags.do_ask && hasAnyFolding(curwin))
// Cursor position may require updating
changed_window_setting();
#endif
vim_regfree(regmatch.regprog);
// Restore the flag values, they can be used for ":&&".
subflags.do_all = save_do_all;
subflags.do_ask = save_do_ask;
}
| 1
|
417,229
|
parse_SET_IP_ECN(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
uint8_t ecn;
char *error;
error = str_to_u8(arg, "ECN", &ecn);
if (error) {
return error;
}
if (ecn & ~IP_ECN_MASK) {
return xasprintf("%s: not a valid ECN", arg);
}
ofpact_put_SET_IP_ECN(ofpacts)->ecn = ecn;
return NULL;
}
| 0
|
192,529
|
void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest) {
dest->Put(SERVER_NON_UNIQUE_NAME, src->Get(SERVER_NON_UNIQUE_NAME));
dest->Put(SERVER_PARENT_ID, src->Get(SERVER_PARENT_ID));
dest->Put(SERVER_MTIME, src->Get(SERVER_MTIME));
dest->Put(SERVER_CTIME, src->Get(SERVER_CTIME));
dest->Put(SERVER_VERSION, src->Get(SERVER_VERSION));
dest->Put(SERVER_IS_DIR, src->Get(SERVER_IS_DIR));
dest->Put(SERVER_IS_DEL, src->Get(SERVER_IS_DEL));
dest->Put(IS_UNAPPLIED_UPDATE, src->Get(IS_UNAPPLIED_UPDATE));
dest->Put(SERVER_SPECIFICS, src->Get(SERVER_SPECIFICS));
dest->Put(SERVER_POSITION_IN_PARENT, src->Get(SERVER_POSITION_IN_PARENT));
}
| 0
|
378,599
|
static void dns_udp_call_loop(struct tevent_req *subreq)
{
struct dns_udp_socket *sock = tevent_req_callback_data(subreq,
struct dns_udp_socket);
struct dns_server *dns = sock->dns_socket->dns;
struct dns_udp_call *call;
uint8_t *buf;
ssize_t len;
int sys_errno;
call = talloc(sock, struct dns_udp_call);
if (call == NULL) {
talloc_free(call);
goto done;
}
call->sock = sock;
len = tdgram_recvfrom_recv(subreq, &sys_errno,
call, &buf, &call->src);
TALLOC_FREE(subreq);
if (len == -1) {
talloc_free(call);
goto done;
}
call->in.data = buf;
call->in.length = len;
DEBUG(10,("Received DNS UDP packet of length %lu from %s\n",
(long)call->in.length,
tsocket_address_string(call->src, call)));
subreq = dns_process_send(call, dns->task->event_ctx, dns,
&call->in);
if (subreq == NULL) {
TALLOC_FREE(call);
goto done;
}
tevent_req_set_callback(subreq, dns_udp_call_process_done, call);
done:
subreq = tdgram_recvfrom_send(sock,
sock->dns_socket->dns->task->event_ctx,
sock->dgram);
if (subreq == NULL) {
task_server_terminate(sock->dns_socket->dns->task,
"no memory for tdgram_recvfrom_send",
true);
return;
}
tevent_req_set_callback(subreq, dns_udp_call_loop, sock);
}
| 0
|
78,336
|
static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset)
{
if (signal_pending(tsk) && !thread_group_empty(tsk)) {
sigset_t newblocked;
/* A set of now blocked but previously unblocked signals. */
sigandnsets(&newblocked, newset, ¤t->blocked);
retarget_shared_pending(tsk, &newblocked);
}
tsk->blocked = *newset;
recalc_sigpending();
}
| 0
|
69,959
|
struct sc_card_driver *sc_get_epass2003_driver(void)
{
return sc_get_driver();
}
| 0
|
118,543
|
static int usb_enumerate_device(struct usb_device *udev)
{
int err;
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (udev->config == NULL) {
err = usb_get_configuration(udev);
if (err < 0) {
if (err != -ENODEV)
dev_err(&udev->dev, "can't read configurations, error %d\n",
err);
return err;
}
}
/* read the standard strings and cache them if present */
udev->product = usb_cache_string(udev, udev->descriptor.iProduct);
udev->manufacturer = usb_cache_string(udev,
udev->descriptor.iManufacturer);
udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
err = usb_enumerate_device_otg(udev);
if (err < 0)
return err;
if (IS_ENABLED(CONFIG_USB_OTG_WHITELIST) && hcd->tpl_support &&
!is_targeted(udev)) {
/* Maybe it can talk to us, though we can't talk to it.
* (Includes HNP test device.)
*/
if (IS_ENABLED(CONFIG_USB_OTG) && (udev->bus->b_hnp_enable
|| udev->bus->is_b_host)) {
err = usb_port_suspend(udev, PMSG_AUTO_SUSPEND);
if (err < 0)
dev_dbg(&udev->dev, "HNP fail, %d\n", err);
}
return -ENOTSUPP;
}
usb_detect_interface_quirks(udev);
return 0;
}
| 0
|
331,619
|
static void spapr_finalize_fdt(sPAPREnvironment *spapr,
hwaddr fdt_addr,
hwaddr rtas_addr,
hwaddr rtas_size)
{
int ret, i;
size_t cb = 0;
char *bootlist;
void *fdt;
sPAPRPHBState *phb;
fdt = g_malloc(FDT_MAX_SIZE);
/* open out the base tree into a temp buffer for the final tweaks */
_FDT((fdt_open_into(spapr->fdt_skel, fdt, FDT_MAX_SIZE)));
ret = spapr_populate_memory(spapr, fdt);
if (ret < 0) {
fprintf(stderr, "couldn't setup memory nodes in fdt\n");
exit(1);
}
ret = spapr_populate_vdevice(spapr->vio_bus, fdt);
if (ret < 0) {
fprintf(stderr, "couldn't setup vio devices in fdt\n");
exit(1);
}
QLIST_FOREACH(phb, &spapr->phbs, list) {
ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
}
if (ret < 0) {
fprintf(stderr, "couldn't setup PCI devices in fdt\n");
exit(1);
}
/* RTAS */
ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size);
if (ret < 0) {
fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
}
/* Advertise NUMA via ibm,associativity */
ret = spapr_fixup_cpu_dt(fdt, spapr);
if (ret < 0) {
fprintf(stderr, "Couldn't finalize CPU device tree properties\n");
}
bootlist = get_boot_devices_list(&cb, true);
if (cb && bootlist) {
int offset = fdt_path_offset(fdt, "/chosen");
if (offset < 0) {
exit(1);
}
for (i = 0; i < cb; i++) {
if (bootlist[i] == '\n') {
bootlist[i] = ' ';
}
}
ret = fdt_setprop_string(fdt, offset, "qemu,boot-list", bootlist);
}
if (!spapr->has_graphics) {
spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
}
_FDT((fdt_pack(fdt)));
if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
fdt_totalsize(fdt), FDT_MAX_SIZE);
exit(1);
}
cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt));
g_free(fdt);
}
| 1
|
492,817
|
void hugetlb_fix_reserve_counts(struct inode *inode)
{
struct hugepage_subpool *spool = subpool_inode(inode);
long rsv_adjust;
bool reserved = false;
rsv_adjust = hugepage_subpool_get_pages(spool, 1);
if (rsv_adjust > 0) {
struct hstate *h = hstate_inode(inode);
if (!hugetlb_acct_memory(h, 1))
reserved = true;
} else if (!rsv_adjust) {
reserved = true;
}
if (!reserved)
pr_warn("hugetlb: Huge Page Reserved count may go negative.\n");
}
| 0
|
78,119
|
static GCObject **sweepgen (lua_State *L, global_State *g, GCObject **p,
GCObject *limit) {
static const lu_byte nextage[] = {
G_SURVIVAL, /* from G_NEW */
G_OLD1, /* from G_SURVIVAL */
G_OLD1, /* from G_OLD0 */
G_OLD, /* from G_OLD1 */
G_OLD, /* from G_OLD (do not change) */
G_TOUCHED1, /* from G_TOUCHED1 (do not change) */
G_TOUCHED2 /* from G_TOUCHED2 (do not change) */
};
int white = luaC_white(g);
GCObject *curr;
while ((curr = *p) != limit) {
if (iswhite(curr)) { /* is 'curr' dead? */
lua_assert(!isold(curr) && isdead(g, curr));
*p = curr->next; /* remove 'curr' from list */
freeobj(L, curr); /* erase 'curr' */
}
else { /* correct mark and age */
if (getage(curr) == G_NEW)
curr->marked = cast_byte((curr->marked & maskgencolors) | white);
setage(curr, nextage[getage(curr)]);
p = &curr->next; /* go to next element */
}
}
return p;
}
| 0
|
172,929
|
void ContextState::RestoreVertexAttribValues() const {
for (size_t attrib = 0; attrib < vertex_attrib_manager->num_attribs();
++attrib) {
switch (attrib_values[attrib].type()) {
case SHADER_VARIABLE_FLOAT:
{
GLfloat v[4];
attrib_values[attrib].GetValues(v);
api()->glVertexAttrib4fvFn(attrib, v);
}
break;
case SHADER_VARIABLE_INT:
{
GLint v[4];
attrib_values[attrib].GetValues(v);
api()->glVertexAttribI4ivFn(attrib, v);
}
break;
case SHADER_VARIABLE_UINT:
{
GLuint v[4];
attrib_values[attrib].GetValues(v);
api()->glVertexAttribI4uivFn(attrib, v);
}
break;
default:
NOTREACHED();
break;
}
}
}
| 0
|
370,157
|
static inline struct sctp_chunk *sctp_outq_dequeue_data(struct sctp_outq *q)
{
struct sctp_chunk *ch = NULL;
if (!list_empty(&q->out_chunk_list)) {
struct list_head *entry = q->out_chunk_list.next;
ch = list_entry(entry, struct sctp_chunk, list);
list_del_init(entry);
q->out_qlen -= ch->skb->len;
}
return ch;
}
| 0
|
174,810
|
gfx::Rect LayerTreeHostImpl::DeviceViewport() const {
if (external_viewport_.IsEmpty())
return gfx::Rect(device_viewport_size_);
return external_viewport_;
}
| 0
|
388,420
|
void CLASS parse_gps_libraw(int base)
{
unsigned entries, tag, type, len, save, c;
entries = get2();
if (entries > 200)
return;
if (entries > 0)
imgdata.other.parsed_gps.gpsparsed = 1;
while (entries--) {
tiff_get(base, &tag, &type, &len, &save);
switch (tag) {
case 1: imgdata.other.parsed_gps.latref = getc(ifp); break;
case 3: imgdata.other.parsed_gps.longref = getc(ifp); break;
case 5: imgdata.other.parsed_gps.altref = getc(ifp); break;
case 2:
if (len == 3)
FORC(3) imgdata.other.parsed_gps.latitude[c] = getreal(type);
break;
case 4:
if (len == 3)
FORC(3) imgdata.other.parsed_gps.longtitude[c] = getreal(type);
break;
case 7:
if (len == 3)
FORC(3) imgdata.other.parsed_gps.gpstimestamp[c] = getreal(type);
break;
case 6:
imgdata.other.parsed_gps.altitude = getreal(type);
break;
case 9: imgdata.other.parsed_gps.gpsstatus = getc(ifp); break;
}
fseek(ifp, save, SEEK_SET);
}
}
| 0
|
36,038
|
Status UpdateNode(const NodeDef* node, bool* refined) {
NodeContext* ctx = GetNodeContext(node);
if (ctx == nullptr) {
TF_RETURN_IF_ERROR(AddNode(node));
ctx = CHECK_NOTNULL(GetNodeContext(node));
*refined = true;
}
// Check if the shapes of the nodes in the fan-in of this node have changed,
// and if they have, update the node input shapes.
InferenceContext* ic = ctx->inference_context.get();
ctx->input_tensors_as_shapes_to_propagate.resize(ic->num_inputs());
ctx->input_tensor_protos.resize(ic->num_inputs(), nullptr);
for (int dst_input = 0; dst_input < ic->num_inputs(); ++dst_input) {
const GraphView::InputPort port(node, dst_input);
const GraphView::OutputPort fanin = graph_.GetRegularFanin(port);
int src_output = fanin.port_id;
const NodeDef* src = fanin.node;
NodeContext* src_ctx = GetNodeContext(src);
if (src_ctx == nullptr) {
return errors::FailedPrecondition(
"Input ", dst_input, " for '", node->name(),
"' was not previously added to SymbolicShapeRefiner.");
}
InferenceContext* src_ic = src_ctx->inference_context.get();
if (src_output >= src_ic->num_outputs()) {
return errors::OutOfRange("src_output = ", src_output,
", but num_outputs is only ",
src_ic->num_outputs());
}
// Propagate input node's NodeContext info to the current node's
// NodeContext:
// output_tensor_protos to input_tensor_protos and input_tensors, and
// output_tensors_as_shapes to input_tensors_as_shapes.
if (static_cast<int>(src_ctx->output_tensors_as_shapes.size()) >
src_output) {
ctx->input_tensors_as_shapes_to_propagate[dst_input] =
src_ctx->output_tensors_as_shapes[src_output];
}
if (static_cast<int>(src_ctx->output_tensor_protos.size()) > src_output) {
const auto* tensor_proto = src_ctx->output_tensor_protos[src_output];
if (tensor_proto != nullptr) {
ctx->input_tensor_protos[dst_input] = tensor_proto;
}
}
// NOTE: we check only shape is refined; we do not (yet) check whether
// tensor value is refined.
if (!*refined &&
!ic->input(dst_input).SameHandle(src_ic->output(src_output))) {
*refined = true;
}
ic->SetInput(dst_input, src_ic->output(src_output));
if (!*refined && ic->requested_input_tensor_as_partial_shape(dst_input)) {
// The input value may have changed. Since we have no way to know if
// that's indeed the case, err on the safe side.
*refined = true;
}
// Also propagate handle shape and dtype of edges which are carrying
// resource handles.
if (ctx->input_types[dst_input] == DT_RESOURCE) {
auto* outputs = src_ic->output_handle_shapes_and_types(src_output);
if (!outputs) continue;
auto* inputs = ic->input_handle_shapes_and_types(dst_input);
if (!inputs || !EquivalentShapesAndTypes(*outputs, *inputs))
*refined = true;
ic->set_input_handle_shapes_and_types(dst_input, *outputs);
}
}
// Make sure we schedule the fanout of resources (which have no input)
// whenever the resources are updated.
*refined |= ic->num_inputs() == 0;
if (!*refined) {
// No input shape has changed, we're done.
return Status::OK();
}
// Convert all kUnknownDimFromConst to -1 for shape inference.
ic->set_input_tensors_as_shapes(ReplaceUnknownDimFromConstWithUnknownDim(
ic, ctx->input_tensors_as_shapes_to_propagate));
// Note: UpdateFunction uses input_tensors_as_shapes and
// input_tensor_protos (not the Tensor object) for input values.
// so for function nodes, we don't need to convert TensorProtos
// to Tensors here. If the current op is not a function op, we convert
// TensorProtos to Tensors before calling InferShapes.
// Properly handle function nodes.
if (ctx->op_data && ctx->op_data->is_function_op) {
// TODO(jmdecker): Detect if the input shapes have changed for this
// function. Note that when we hit a function call node, refined will be
// true, as the updates to the call node will have changed, even if it's
// the same function being called twice with the same input shapes.
// Example: simple_function.pbtxt
if (aggressive_shape_inference_) {
// If output shapes are annotated, use it and skip UpdateFunction();
// it can be very expensive when a function node has nested function
// nodes internally. One downside with this approach is that we do not
// get output values or output shapes as tensor from function node.
auto s = UpdateOutputShapesUsingAnnotatedInformation(*node, ctx);
if (s.ok() && AllOutputShapesKnown(ctx)) {
return Status::OK();
}
// If shape annotation was not available, incomplete, or incompatible,
// fall through to call UpdateFunction().
}
auto s = UpdateFunction(node);
if (s.ok()) {
return Status::OK();
} else {
VLOG(1) << "UpdateFunction failed for " << node->op()
<< ". Defaulting to ShapeUnknown.\n"
<< s.ToString();
}
}
// Construct Tensors for constant inputs used by shape functions.
std::vector<Tensor> const_values(ic->num_inputs());
std::vector<const Tensor*> input_tensors(ic->num_inputs(), nullptr);
for (int dst_input = 0; dst_input < ic->num_inputs(); ++dst_input) {
const TensorProto* tensor_proto = ctx->input_tensor_protos[dst_input];
if (tensor_proto != nullptr &&
// Skip if the const tensor is too large.
NumElementsFromTensorProto(*tensor_proto) <=
kThresholdToSkipConstTensorInstantiation &&
const_values[dst_input].FromProto(*tensor_proto)) {
input_tensors[dst_input] = &const_values[dst_input];
}
}
ic->set_input_tensors(input_tensors);
// Update the shapes of the outputs.
return InferShapes(*node, ctx);
}
| 0
|
240,537
|
~SendLivePreviewTask() {
}
| 0
|
449,107
|
CNF_AddRefclocks(void)
{
unsigned int i;
for (i = 0; i < ARR_GetSize(refclock_sources); i++) {
RCL_AddRefclock((RefclockParameters *)ARR_GetElement(refclock_sources, i));
}
ARR_SetSize(refclock_sources, 0);
}
| 0
|
249,429
|
WebKitWebDataSource* webkit_web_frame_get_data_source(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
Frame* coreFrame = core(frame);
return webkit_web_frame_get_data_source_from_core_loader(coreFrame->loader()->documentLoader());
}
| 0
|
240,862
|
static int piv_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
{
piv_private_data_t * priv = PIV_DATA(card);
u8 * opts; /* A or M, key_ref, alg_id */
LOG_FUNC_CALLED(card->ctx);
sc_log(card->ctx, "cmd=%ld ptr=%p", cmd, ptr);
if (priv == NULL) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INTERNAL);
}
switch(cmd) {
case SC_CARDCTL_PIV_AUTHENTICATE:
opts = (u8 *)ptr;
switch (*opts) {
case 'A':
return piv_general_external_authenticate(card,
*(opts+1), *(opts+2));
break;
case 'M':
return piv_general_mutual_authenticate(card,
*(opts+1), *(opts+2));
break;
}
break;
case SC_CARDCTL_PIV_GENERATE_KEY:
return piv_generate_key(card,
(sc_cardctl_piv_genkey_info_t *) ptr);
break;
case SC_CARDCTL_GET_SERIALNR:
return piv_get_serial_nr_from_CHUI(card, (sc_serial_number_t *) ptr);
break;
case SC_CARDCTL_PIV_PIN_PREFERENCE:
return piv_get_pin_preference(card, ptr);
break;
case SC_CARDCTL_PIV_OBJECT_PRESENT:
return piv_is_object_present(card, ptr);
break;
}
LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED);
}
| 0
|
227,864
|
static void HighEntropyMethodWithMeasureMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestObject* impl = V8TestObject::ToImpl(info.Holder());
impl->highEntropyMethodWithMeasure();
}
| 0
|
460,711
|
void red_stream_set_core_interface(RedStream *stream, SpiceCoreInterfaceInternal *core)
{
red_stream_remove_watch(stream);
stream->priv->core = core;
}
| 0
|
129,467
|
static struct hubp *dcn10_hubp_create(
struct dc_context *ctx,
uint32_t inst)
{
struct dcn10_hubp *hubp1 =
kzalloc(sizeof(struct dcn10_hubp), GFP_KERNEL);
if (!hubp1)
return NULL;
dcn10_hubp_construct(hubp1, ctx, inst,
&hubp_regs[inst], &hubp_shift, &hubp_mask);
return &hubp1->base;
}
| 0
|
15,458
|
mtime_t decoder_GetDisplayDate ( decoder_t * p_dec , mtime_t i_ts ) {
if ( ! p_dec -> pf_get_display_date ) return VLC_TS_INVALID ;
return p_dec -> pf_get_display_date ( p_dec , i_ts ) ;
}
| 0
|
203,887
|
void ImageLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Image);
info.addMember(m_element, "element");
info.addMember(m_image.get(), "image", WTF::RetainingPointer);
info.addMember(m_derefElementTimer, "derefElementTimer");
info.addMember(m_failedLoadURL, "failedLoadURL");
}
| 0
|
290,277
|
int ssl3_num_ciphers ( void ) {
return ( SSL3_NUM_CIPHERS ) ;
}
| 0
|
310,802
|
void TransportTexture::ReleaseTextures() {
texture_map_.clear();
bool ret = sender_->Send(new GpuTransportTextureHostMsg_ReleaseTextures(
host_id_));
if (!ret) {
LOG(ERROR) << "GpuTransportTexture_ReleaseTextures failed";
}
}
| 0
|
118,142
|
void CL_RequestMotd( void ) {
#ifdef UPDATE_SERVER_NAME
char info[MAX_INFO_STRING];
if ( !cl_motd->integer ) {
return;
}
Com_Printf( "Resolving %s\n", UPDATE_SERVER_NAME );
if ( !NET_StringToAdr( UPDATE_SERVER_NAME, &cls.updateServer, NA_IP ) ) {
Com_Printf( "Couldn't resolve address\n" );
return;
}
cls.updateServer.port = BigShort( PORT_UPDATE );
Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", UPDATE_SERVER_NAME,
cls.updateServer.ip[0], cls.updateServer.ip[1],
cls.updateServer.ip[2], cls.updateServer.ip[3],
BigShort( cls.updateServer.port ) );
info[0] = 0;
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
Info_SetValueForKey( info, "version", com_version->string );
NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd \"%s\"\n", info );
#endif
}
| 0
|
433,376
|
static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m,
unsigned int flags)
{
bool tgid = flags & TRACE_ITER_RECORD_TGID;
const char tgid_space[] = " ";
const char space[] = " ";
seq_printf(m, "# %s _-----=> irqs-off\n",
tgid ? tgid_space : space);
seq_printf(m, "# %s / _----=> need-resched\n",
tgid ? tgid_space : space);
seq_printf(m, "# %s| / _---=> hardirq/softirq\n",
tgid ? tgid_space : space);
seq_printf(m, "# %s|| / _--=> preempt-depth\n",
tgid ? tgid_space : space);
seq_printf(m, "# %s||| / delay\n",
tgid ? tgid_space : space);
seq_printf(m, "# TASK-PID CPU#%s|||| TIMESTAMP FUNCTION\n",
tgid ? " TGID " : space);
seq_printf(m, "# | | | %s|||| | |\n",
tgid ? " | " : space);
}
| 0
|
137,642
|
TEST_F(SslContextImplTest, TestExpiredCert) {
const std::string yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/expired_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/expired_key.pem"
)EOF";
envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext tls_context;
TestUtility::loadFromYaml(TestEnvironment::substitute(yaml), tls_context);
ClientContextConfigImpl cfg(tls_context, factory_context_);
Envoy::Ssl::ClientContextSharedPtr context(manager_.createSslClientContext(store_, cfg, nullptr));
EXPECT_EQ(0U, context->daysUntilFirstCertExpires());
}
| 0
|
31,184
|
static const gchar * get_register_name_from_address ( guint64 addr , gboolean * is_custom_register , u3v_conv_info_t * u3v_conv_info ) {
const gchar * address_string = NULL ;
guint32 offset_address ;
if ( is_custom_register != NULL ) {
* is_custom_register = FALSE ;
}
if ( addr < 0x10000 ) {
offset_address = ( guint32 ) addr ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_abrm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> sbrm_addr != 0 && ( addr >= u3v_conv_info -> sbrm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> sbrm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_sbrm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> sirm_addr != 0 && ( addr >= u3v_conv_info -> sirm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> sirm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_sirm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> eirm_addr != 0 && ( addr >= u3v_conv_info -> eirm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> eirm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_eirm ) ;
}
if ( ! address_string ) {
address_string = wmem_strdup_printf ( wmem_packet_scope ( ) , "[Addr:0x%016" G_GINT64_MODIFIER "X]" , addr ) ;
if ( is_custom_register != NULL ) {
* is_custom_register = TRUE ;
}
}
return address_string ;
}
| 0
|
195,367
|
unsigned long GetFaceName(FPDF_SYSFONTINFO* sysfontinfo,
void* hFont,
char* buffer,
unsigned long buffer_size) {
auto* fontinfo_with_metrics =
static_cast<FPDF_SYSFONTINFO_WITHMETRICS*>(sysfontinfo);
if (!fontinfo_with_metrics->default_sysfontinfo->GetFaceName)
return 0;
return fontinfo_with_metrics->default_sysfontinfo->GetFaceName(
fontinfo_with_metrics->default_sysfontinfo, hFont, buffer, buffer_size);
}
| 0
|
452,922
|
static bool torture_smb2_notify_basedir(struct torture_context *torture,
struct smb2_tree *tree1,
struct smb2_tree *tree2)
{
bool ret = true;
NTSTATUS status;
union smb_notify notify;
union smb_open io;
struct smb2_handle h1;
struct smb2_request *req1;
smb2_deltree(tree1, BASEDIR_BAS);
smb2_util_rmdir(tree1, BASEDIR_BAS);
torture_comment(torture, "TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
/* get a handle on the directory */
ZERO_STRUCT(io.smb2);
io.generic.level = RAW_OPEN_SMB2;
io.smb2.in.create_flags = 0;
io.smb2.in.desired_access = SEC_FILE_ALL;
io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
NTCREATEX_SHARE_ACCESS_WRITE;
io.smb2.in.alloc_size = 0;
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
io.smb2.in.impersonation_level = NTCREATEX_IMPERSONATION_ANONYMOUS;
io.smb2.in.security_flags = 0;
io.smb2.in.fname = BASEDIR_BAS;
status = smb2_create(tree1, torture, &(io.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
h1 = io.smb2.out.file.handle;
/* create a test file that will also be modified */
io.smb2.in.fname = BASEDIR_BAS "\\tname1";
io.smb2.in.create_options = NTCREATEX_OPTIONS_NON_DIRECTORY_FILE;
status = smb2_create(tree2, torture, &(io.smb2));
CHECK_STATUS(status,NT_STATUS_OK);
smb2_util_close(tree2, io.smb2.out.file.handle);
/* ask for a change notify, on attribute changes. */
ZERO_STRUCT(notify.smb2);
notify.smb2.level = RAW_NOTIFY_SMB2;
notify.smb2.in.buffer_size = 1000;
notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_ATTRIBUTES;
notify.smb2.in.file.handle = h1;
notify.smb2.in.recursive = true;
req1 = smb2_notify_send(tree1, &(notify.smb2));
/* set attribute on the base dir */
smb2_util_setatr(tree2, BASEDIR_BAS, FILE_ATTRIBUTE_HIDDEN);
/* set attribute on a file to assure we receive a notification */
smb2_util_setatr(tree2, BASEDIR_BAS "\\tname1", FILE_ATTRIBUTE_HIDDEN);
smb_msleep(200);
/* check how many responses were given, expect only 1 for the file */
status = smb2_notify_recv(req1, torture, &(notify.smb2));
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(notify.smb2.out.num_changes, 1);
CHECK_VAL(notify.smb2.out.changes[0].action, NOTIFY_ACTION_MODIFIED);
CHECK_WIRE_STR(notify.smb2.out.changes[0].name, "tname1");
done:
smb2_deltree(tree1, BASEDIR_BAS);
return ret;
}
| 0
|
504,591
|
lstnActivity(ptcplstn_t *const pLstn)
{
int newSock = -1;
prop_t *peerName;
prop_t *peerIP;
rsRetVal localRet;
DEFiRet;
DBGPRINTF("imptcp: new connection on listen socket %d\n", pLstn->sock);
while(glbl.GetGlobalInputTermState() == 0) {
localRet = AcceptConnReq(pLstn, &newSock, &peerName, &peerIP);
DBGPRINTF("imptcp: AcceptConnReq on listen socket %d returned %d\n", pLstn->sock, localRet);
if(localRet == RS_RET_NO_MORE_DATA || glbl.GetGlobalInputTermState() == 1) {
break;
}
CHKiRet(localRet);
localRet = addSess(pLstn, newSock, peerName, peerIP);
if(localRet != RS_RET_OK) {
close(newSock);
prop.Destruct(&peerName);
prop.Destruct(&peerIP);
ABORT_FINALIZE(localRet);
}
}
finalize_it:
RETiRet;
}
| 0
|
469,643
|
virSecuritySELinuxGetModel(virSecurityManager *mgr G_GNUC_UNUSED)
{
return SECURITY_SELINUX_NAME;
}
| 0
|
174,501
|
static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {
uint32_t length = static_cast<uint32_t>(GetString(holder)->length());
if (entry < length) {
PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
return PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell);
}
return BackingStoreAccessor::GetDetailsImpl(holder, entry - length);
}
| 0
|
422,899
|
static inline void dccp_mib_exit(void)
{
snmp_mib_free((void __percpu **)dccp_statistics);
}
| 0
|
394,955
|
static struct Curl_sh_entry *sh_addentry(struct curl_hash *sh,
curl_socket_t s,
struct Curl_easy *data)
{
struct Curl_sh_entry *there = sh_getentry(sh, s);
struct Curl_sh_entry *check;
if(there)
/* it is present, return fine */
return there;
/* not present, add it */
check = calloc(1, sizeof(struct Curl_sh_entry));
if(!check)
return NULL; /* major failure */
check->easy = data;
check->socket = s;
/* make/add new hash entry */
if(!Curl_hash_add(sh, (char *)&s, sizeof(curl_socket_t), check)) {
free(check);
return NULL; /* major failure */
}
return check; /* things are good in sockhash land */
}
| 0
|
286,246
|
void RenderFrameImpl::WasHidden() {
for (auto& observer : observers_)
observer.WasHidden();
#if BUILDFLAG(ENABLE_PLUGINS)
for (auto* plugin : active_pepper_instances_)
plugin->PageVisibilityChanged(false);
#endif // ENABLE_PLUGINS
if (GetWebFrame()->FrameWidget()) {
GetWebFrame()->FrameWidget()->SetVisibilityState(VisibilityState());
}
}
| 0
|
78,675
|
TEST(ArrayWriterTest, WChar) {
wchar_t array[10];
fmt::WArrayWriter w(array);
w.write(L"{}", 42);
EXPECT_EQ(L"42", w.str());
}
| 0
|
305,167
|
static void nfs4_layoutcommit_release(void *calldata)
{
struct nfs4_layoutcommit_data *data = calldata;
struct pnfs_layout_segment *lseg, *tmp;
unsigned long *bitlock = &NFS_I(data->args.inode)->flags;
pnfs_cleanup_layoutcommit(data);
/* Matched by references in pnfs_set_layoutcommit */
list_for_each_entry_safe(lseg, tmp, &data->lseg_list, pls_lc_list) {
list_del_init(&lseg->pls_lc_list);
if (test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT,
&lseg->pls_flags))
put_lseg(lseg);
}
clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock);
smp_mb__after_clear_bit();
wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING);
put_rpccred(data->cred);
kfree(data);
}
| 0
|
445,529
|
NetworkListenSocket(IoHandlePtr&& io_handle, const Address::InstanceConstSharedPtr& address,
const Network::Socket::OptionsSharedPtr& options)
: ListenSocketImpl(std::move(io_handle), address) {
setListenSocketOptions(options);
}
| 0
|
202,541
|
GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride,
const void* ptr) {
glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
}
| 0
|
248,472
|
void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
WebMouseEvent mouse_event(WebInputEvent::kMouseDown,
WebInputEvent::kNoModifiers,
ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
mouse_event.button = WebMouseEvent::Button::kLeft;
mouse_event.SetPositionInWidget(point.x(), point.y());
mouse_event.click_count = 1;
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
impl->OnMessageReceived(InputMsg_HandleInputEvent(
0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
mouse_event.SetType(WebInputEvent::kMouseUp);
impl->OnMessageReceived(InputMsg_HandleInputEvent(
0, &mouse_event, std::vector<const WebInputEvent*>(), ui::LatencyInfo(),
InputEventDispatchType::DISPATCH_TYPE_BLOCKING));
}
| 0
|
194,964
|
void SVGDocumentExtensions::removeTimeContainer(SVGSVGElement* element)
{
m_timeContainers.remove(element);
}
| 0
|
274,408
|
void Flush() {
HandleScope scope;
Local<Value> cb = handle_->Get(on_headers_sym);
if (!cb->IsFunction())
return;
Handle<Value> argv[2] = {
CreateHeaders(),
url_.ToString()
};
Local<Value> r = Local<Function>::Cast(cb)->Call(handle_, 2, argv);
if (r.IsEmpty())
got_exception_ = true;
url_.Reset();
have_flushed_ = true;
}
| 0
|
142,751
|
void add_subst_list(char list[][NAME_LENGTH], char value[][NAME_LENGTH], char *item, char *str, int *i) {
strlcpy(list[*i], item, NAME_LENGTH);
strlcpy(value[(*i)++], str, NAME_LENGTH);
}
| 0
|
497,899
|
static void fix_index_entry_timestamps(AVStream* st, int end_index, int64_t end_ts,
int64_t* frame_duration_buffer,
int frame_duration_buffer_size) {
FFStream *const sti = ffstream(st);
int i = 0;
av_assert0(end_index >= 0 && end_index <= sti->nb_index_entries);
for (i = 0; i < frame_duration_buffer_size; i++) {
end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 - i];
sti->index_entries[end_index - 1 - i].timestamp = end_ts;
}
}
| 0
|
293,068
|
int FLTValidForBBoxFilter(FilterEncodingNode *psFilterNode)
{
int nCount = 0;
if (!psFilterNode || !psFilterNode->pszValue)
return 1;
nCount = FLTNumberOfFilterType(psFilterNode, "BBOX");
if (nCount > 1)
return 0;
else if (nCount == 0)
return 1;
/* nCount ==1 */
if (strcasecmp(psFilterNode->pszValue, "BBOX") == 0)
return 1;
if (strcasecmp(psFilterNode->pszValue, "AND") == 0) {
return FLTValidForBBoxFilter(psFilterNode->psLeftNode) &&
FLTValidForBBoxFilter(psFilterNode->psRightNode);
}
return 0;
}
| 0
|
100,391
|
static int nfc_genl_setup_device_added(struct nfc_dev *dev, struct sk_buff *msg)
{
if (nla_put_string(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev)) ||
nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) ||
nla_put_u32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols) ||
nla_put_u8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up) ||
nla_put_u8(msg, NFC_ATTR_RF_MODE, dev->rf_mode))
return -1;
return 0;
}
| 0
|
401,670
|
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
{
USE_OPLINE
ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
if (EG(error_reporting)) {
do {
EG(error_reporting) = 0;
if (!EG(error_reporting_ini_entry)) {
zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
if (zv) {
EG(error_reporting_ini_entry) = (zend_ini_entry *)Z_PTR_P(zv);
} else {
break;
}
}
if (!EG(error_reporting_ini_entry)->modified) {
if (!EG(modified_ini_directives)) {
ALLOC_HASHTABLE(EG(modified_ini_directives));
zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
}
if (EXPECTED(zend_hash_add_ptr(EG(modified_ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), EG(error_reporting_ini_entry)) != NULL)) {
EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
EG(error_reporting_ini_entry)->modified = 1;
}
}
} while (0);
}
ZEND_VM_NEXT_OPCODE();
}
| 0
|
26,675
|
static int header_bin_le ( struct archive_read * a , struct cpio * cpio , struct archive_entry * entry , size_t * namelength , size_t * name_pad ) {
const void * h ;
const unsigned char * header ;
a -> archive . archive_format = ARCHIVE_FORMAT_CPIO_BIN_LE ;
a -> archive . archive_format_name = "cpio (little-endian binary)" ;
h = __archive_read_ahead ( a , bin_header_size , NULL ) ;
if ( h == NULL ) {
archive_set_error ( & a -> archive , 0 , "End of file trying to read next cpio header" ) ;
return ( ARCHIVE_FATAL ) ;
}
header = ( const unsigned char * ) h ;
archive_entry_set_dev ( entry , header [ bin_dev_offset ] + header [ bin_dev_offset + 1 ] * 256 ) ;
archive_entry_set_ino ( entry , header [ bin_ino_offset ] + header [ bin_ino_offset + 1 ] * 256 ) ;
archive_entry_set_mode ( entry , header [ bin_mode_offset ] + header [ bin_mode_offset + 1 ] * 256 ) ;
archive_entry_set_uid ( entry , header [ bin_uid_offset ] + header [ bin_uid_offset + 1 ] * 256 ) ;
archive_entry_set_gid ( entry , header [ bin_gid_offset ] + header [ bin_gid_offset + 1 ] * 256 ) ;
archive_entry_set_nlink ( entry , header [ bin_nlink_offset ] + header [ bin_nlink_offset + 1 ] * 256 ) ;
archive_entry_set_rdev ( entry , header [ bin_rdev_offset ] + header [ bin_rdev_offset + 1 ] * 256 ) ;
archive_entry_set_mtime ( entry , le4 ( header + bin_mtime_offset ) , 0 ) ;
* namelength = header [ bin_namesize_offset ] + header [ bin_namesize_offset + 1 ] * 256 ;
* name_pad = * namelength & 1 ;
cpio -> entry_bytes_remaining = le4 ( header + bin_filesize_offset ) ;
archive_entry_set_size ( entry , cpio -> entry_bytes_remaining ) ;
cpio -> entry_padding = cpio -> entry_bytes_remaining & 1 ;
__archive_read_consume ( a , bin_header_size ) ;
return ( ARCHIVE_OK ) ;
}
| 0
|
11,526
|
void SocketStreamDispatcherHost::OnSSLCertificateError(
net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) {
int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id="
<< socket_id;
if (socket_id == content::kNoSocketId) {
LOG(ERROR) << "NoSocketId in OnSSLCertificateError";
return;
}
SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id);
DCHECK(socket_stream_host);
content::GlobalRequestID request_id(-1, socket_id);
SSLManager::OnSSLCertificateError(ssl_delegate_weak_factory_.GetWeakPtr(),
request_id, ResourceType::SUB_RESOURCE, socket->url(),
render_process_id_, socket_stream_host->render_view_id(), ssl_info,
fatal);
}
| 1
|
513,694
|
napi_status napi_set_named_property(napi_env env,
napi_value object,
const char* utf8name,
napi_value value) {
NAPI_PREAMBLE(env);
CHECK_ARG(env, value);
v8::Local<v8::Context> context = env->context();
v8::Local<v8::Object> obj;
CHECK_TO_OBJECT(env, context, obj, object);
v8::Local<v8::Name> key;
CHECK_NEW_FROM_UTF8(env, key, utf8name);
v8::Local<v8::Value> val = v8impl::V8LocalValueFromJsValue(value);
v8::Maybe<bool> set_maybe = obj->Set(context, key, val);
RETURN_STATUS_IF_FALSE(env, set_maybe.FromMaybe(false), napi_generic_failure);
return GET_RETURN_STATUS(env);
}
| 0
|
522,031
|
double Item_func_mod::real_op()
{
DBUG_ASSERT(fixed == 1);
double value= args[0]->val_real();
double val2= args[1]->val_real();
if ((null_value= args[0]->null_value || args[1]->null_value))
return 0.0; /* purecov: inspected */
if (val2 == 0.0)
{
signal_divide_by_null();
return 0.0;
}
return fmod(value,val2);
}
| 0
|
48,001
|
static int init_dimensions(H264Context *h)
{
int width = h->width - (h->sps.crop_right + h->sps.crop_left);
int height = h->height - (h->sps.crop_top + h->sps.crop_bottom);
av_assert0(h->sps.crop_right + h->sps.crop_left < (unsigned)h->width);
av_assert0(h->sps.crop_top + h->sps.crop_bottom < (unsigned)h->height);
/* handle container cropping */
if (!h->sps.crop &&
FFALIGN(h->avctx->width, 16) == h->width &&
FFALIGN(h->avctx->height, 16) == h->height) {
width = h->avctx->width;
height = h->avctx->height;
}
if (width <= 0 || height <= 0) {
av_log(h->avctx, AV_LOG_ERROR, "Invalid cropped dimensions: %dx%d.\n",
width, height);
if (h->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
av_log(h->avctx, AV_LOG_WARNING, "Ignoring cropping information.\n");
h->sps.crop_bottom = h->sps.crop_top = h->sps.crop_right = h->sps.crop_left = 0;
h->sps.crop = 0;
width = h->width;
height = h->height;
}
h->avctx->coded_width = h->width;
h->avctx->coded_height = h->height;
h->avctx->width = width;
h->avctx->height = height;
return 0;
}
| 0
|
291,511
|
static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
{
struct sockaddr_iucv *sa = (struct sockaddr_iucv *) addr;
struct sock *sk = sock->sk;
struct iucv_sock *iucv;
int err = 0;
struct net_device *dev;
char uid[9];
/* Verify the input sockaddr */
if (!addr || addr->sa_family != AF_IUCV)
return -EINVAL;
lock_sock(sk);
if (sk->sk_state != IUCV_OPEN) {
err = -EBADFD;
goto done;
}
write_lock_bh(&iucv_sk_list.lock);
iucv = iucv_sk(sk);
if (__iucv_get_sock_by_name(sa->siucv_name)) {
err = -EADDRINUSE;
goto done_unlock;
}
if (iucv->path)
goto done_unlock;
/* Bind the socket */
if (pr_iucv)
if (!memcmp(sa->siucv_user_id, iucv_userid, 8))
goto vm_bind; /* VM IUCV transport */
/* try hiper transport */
memcpy(uid, sa->siucv_user_id, sizeof(uid));
ASCEBC(uid, 8);
rcu_read_lock();
for_each_netdev_rcu(&init_net, dev) {
if (!memcmp(dev->perm_addr, uid, 8)) {
memcpy(iucv->src_name, sa->siucv_name, 8);
memcpy(iucv->src_user_id, sa->siucv_user_id, 8);
sk->sk_bound_dev_if = dev->ifindex;
iucv->hs_dev = dev;
dev_hold(dev);
sk->sk_state = IUCV_BOUND;
iucv->transport = AF_IUCV_TRANS_HIPER;
if (!iucv->msglimit)
iucv->msglimit = IUCV_HIPER_MSGLIM_DEFAULT;
rcu_read_unlock();
goto done_unlock;
}
}
rcu_read_unlock();
vm_bind:
if (pr_iucv) {
/* use local userid for backward compat */
memcpy(iucv->src_name, sa->siucv_name, 8);
memcpy(iucv->src_user_id, iucv_userid, 8);
sk->sk_state = IUCV_BOUND;
iucv->transport = AF_IUCV_TRANS_IUCV;
if (!iucv->msglimit)
iucv->msglimit = IUCV_QUEUELEN_DEFAULT;
goto done_unlock;
}
/* found no dev to bind */
err = -ENODEV;
done_unlock:
/* Release the socket list lock */
write_unlock_bh(&iucv_sk_list.lock);
done:
release_sock(sk);
return err;
}
| 0
|
114,685
|
static SQInteger class_newmember(HSQUIRRELVM v)
{
SQInteger top = sq_gettop(v);
SQBool bstatic = SQFalse;
if(top == 5)
{
sq_tobool(v,-1,&bstatic);
sq_pop(v,1);
}
if(top < 4) {
sq_pushnull(v);
}
return SQ_SUCCEEDED(sq_newmember(v,-4,bstatic))?1:SQ_ERROR;
}
| 0
|
378,979
|
static unsigned LZ4_count(const BYTE* pIn, const BYTE* pRef, const BYTE* pInLimit)
{
const BYTE* const pStart = pIn;
while (likely(pIn<pInLimit-(STEPSIZE-1)))
{
size_t diff = AARCH(pRef) ^ AARCH(pIn);
if (!diff) { pIn+=STEPSIZE; pRef+=STEPSIZE; continue; }
pIn += LZ4_NbCommonBytes(diff);
return (unsigned)(pIn - pStart);
}
if (sizeof(void*)==8) if ((pIn<(pInLimit-3)) && (A32(pRef) == A32(pIn))) { pIn+=4; pRef+=4; }
if ((pIn<(pInLimit-1)) && (A16(pRef) == A16(pIn))) { pIn+=2; pRef+=2; }
if ((pIn<pInLimit) && (*pRef == *pIn)) pIn++;
return (unsigned)(pIn - pStart);
}
| 0
|
149,928
|
size_t Magick::Image::totalColors(void) const
{
size_t
colors;
GetPPException;
colors=GetNumberColors(constImage(),(FILE *) NULL,exceptionInfo);
ThrowImageException;
return colors;
}
| 0
|
118,013
|
static BOOL rdp_write_draw_nine_grid_cache_capability_set(wStream* s, const rdpSettings* settings)
{
size_t header;
UINT32 drawNineGridSupportLevel;
if (!Stream_EnsureRemainingCapacity(s, 32))
return FALSE;
header = rdp_capability_set_start(s);
drawNineGridSupportLevel =
(settings->DrawNineGridEnabled) ? DRAW_NINEGRID_SUPPORTED_V2 : DRAW_NINEGRID_NO_SUPPORT;
Stream_Write_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */
Stream_Write_UINT16(s, settings->DrawNineGridCacheSize); /* drawNineGridCacheSize (2 bytes) */
Stream_Write_UINT16(
s, settings->DrawNineGridCacheEntries); /* drawNineGridCacheEntries (2 bytes) */
rdp_capability_set_finish(s, header, CAPSET_TYPE_DRAW_NINE_GRID_CACHE);
return TRUE;
}
| 0
|
284,277
|
content::ResourceRequestInfo::WebContentsGetter GetWebContentsGetter(
content::WebContents* web_contents) {
int frame_tree_node_id = web_contents->GetMainFrame()->GetFrameTreeNodeId();
if (frame_tree_node_id != -1) {
return base::Bind(content::WebContents::FromFrameTreeNodeId,
frame_tree_node_id);
}
return base::Bind(&GetWebContentsByFrameID,
web_contents->GetMainFrame()->GetProcess()->GetID(),
web_contents->GetMainFrame()->GetRoutingID());
}
| 0
|
494,739
|
display_debug_rnglists_list (unsigned char * start,
unsigned char * finish,
unsigned int pointer_size,
dwarf_vma offset,
dwarf_vma base_address,
unsigned int offset_size)
{
unsigned char *next = start;
unsigned int debug_addr_section_hdr_len;
if (offset_size == 4)
debug_addr_section_hdr_len = 8;
else
debug_addr_section_hdr_len = 16;
while (1)
{
dwarf_vma off = offset + (start - next);
enum dwarf_range_list_entry rlet;
/* Initialize it due to a false compiler warning. */
dwarf_vma begin = -1, length, end = -1;
if (start >= finish)
{
warn (_("Range list starting at offset 0x%s is not terminated.\n"),
dwarf_vmatoa ("x", offset));
break;
}
printf (" ");
print_dwarf_vma (off, 4);
SAFE_BYTE_GET_AND_INC (rlet, start, 1, finish);
switch (rlet)
{
case DW_RLE_end_of_list:
printf (_("<End of list>\n"));
break;
case DW_RLE_base_addressx:
READ_ULEB (base_address, start, finish);
print_dwarf_vma (base_address, pointer_size);
printf (_("(base address index) "));
base_address = fetch_indexed_addr ((base_address * pointer_size)
+ debug_addr_section_hdr_len, pointer_size);
print_dwarf_vma (base_address, pointer_size);
printf (_("(base address)\n"));
break;
case DW_RLE_startx_endx:
READ_ULEB (begin, start, finish);
READ_ULEB (end, start, finish);
begin = fetch_indexed_addr ((begin * pointer_size)
+ debug_addr_section_hdr_len, pointer_size);
end = fetch_indexed_addr ((begin * pointer_size)
+ debug_addr_section_hdr_len, pointer_size);
break;
case DW_RLE_startx_length:
READ_ULEB (begin, start, finish);
READ_ULEB (length, start, finish);
begin = fetch_indexed_addr ((begin * pointer_size)
+ debug_addr_section_hdr_len, pointer_size);
end = begin + length;
break;
case DW_RLE_offset_pair:
READ_ULEB (begin, start, finish);
READ_ULEB (end, start, finish);
break;
case DW_RLE_base_address:
SAFE_BYTE_GET_AND_INC (base_address, start, pointer_size, finish);
print_dwarf_vma (base_address, pointer_size);
printf (_("(base address)\n"));
break;
case DW_RLE_start_end:
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
SAFE_BYTE_GET_AND_INC (end, start, pointer_size, finish);
break;
case DW_RLE_start_length:
SAFE_BYTE_GET_AND_INC (begin, start, pointer_size, finish);
READ_ULEB (length, start, finish);
end = begin + length;
break;
default:
error (_("Invalid range list entry type %d\n"), rlet);
rlet = DW_RLE_end_of_list;
break;
}
if (rlet == DW_RLE_end_of_list)
break;
if (rlet == DW_RLE_base_address || rlet == DW_RLE_base_addressx)
continue;
/* Only a DW_RLE_offset_pair needs the base address added. */
if (rlet == DW_RLE_offset_pair)
{
begin += base_address;
end += base_address;
}
print_dwarf_vma (begin, pointer_size);
print_dwarf_vma (end, pointer_size);
if (begin == end)
fputs (_("(start == end)"), stdout);
else if (begin > end)
fputs (_("(start > end)"), stdout);
putchar ('\n');
}
}
| 0
|
265,952
|
static int packet_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
int len;
int val, lv = sizeof(val);
struct sock *sk = sock->sk;
struct packet_sock *po = pkt_sk(sk);
void *data = &val;
union tpacket_stats_u st;
if (level != SOL_PACKET)
return -ENOPROTOOPT;
if (get_user(len, optlen))
return -EFAULT;
if (len < 0)
return -EINVAL;
switch (optname) {
case PACKET_STATISTICS:
spin_lock_bh(&sk->sk_receive_queue.lock);
memcpy(&st, &po->stats, sizeof(st));
memset(&po->stats, 0, sizeof(po->stats));
spin_unlock_bh(&sk->sk_receive_queue.lock);
if (po->tp_version == TPACKET_V3) {
lv = sizeof(struct tpacket_stats_v3);
st.stats3.tp_packets += st.stats3.tp_drops;
data = &st.stats3;
} else {
lv = sizeof(struct tpacket_stats);
st.stats1.tp_packets += st.stats1.tp_drops;
data = &st.stats1;
}
break;
case PACKET_AUXDATA:
val = po->auxdata;
break;
case PACKET_ORIGDEV:
val = po->origdev;
break;
case PACKET_VNET_HDR:
val = po->has_vnet_hdr;
break;
case PACKET_VERSION:
val = po->tp_version;
break;
case PACKET_HDRLEN:
if (len > sizeof(int))
len = sizeof(int);
if (copy_from_user(&val, optval, len))
return -EFAULT;
switch (val) {
case TPACKET_V1:
val = sizeof(struct tpacket_hdr);
break;
case TPACKET_V2:
val = sizeof(struct tpacket2_hdr);
break;
case TPACKET_V3:
val = sizeof(struct tpacket3_hdr);
break;
default:
return -EINVAL;
}
break;
case PACKET_RESERVE:
val = po->tp_reserve;
break;
case PACKET_LOSS:
val = po->tp_loss;
break;
case PACKET_TIMESTAMP:
val = po->tp_tstamp;
break;
case PACKET_FANOUT:
val = (po->fanout ?
((u32)po->fanout->id |
((u32)po->fanout->type << 16) |
((u32)po->fanout->flags << 24)) :
0);
break;
case PACKET_TX_HAS_OFF:
val = po->tp_tx_has_off;
break;
default:
return -ENOPROTOOPT;
}
if (len > lv)
len = lv;
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, data, len))
return -EFAULT;
return 0;
}
| 0
|
326,094
|
static av_cold int peak_init_writer(AVFormatContext *s)
{
WAVMuxContext *wav = s->priv_data;
AVCodecContext *enc = s->streams[0]->codec;
if (enc->codec_id != AV_CODEC_ID_PCM_S8 &&
enc->codec_id != AV_CODEC_ID_PCM_S16LE &&
enc->codec_id != AV_CODEC_ID_PCM_U8 &&
enc->codec_id != AV_CODEC_ID_PCM_U16LE) {
av_log(s, AV_LOG_ERROR, "%s codec not supported for Peak Chunk\n",
s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
return -1;
}
wav->peak_bps = av_get_bits_per_sample(enc->codec_id) / 8;
if (wav->peak_bps == 1 && wav->peak_format == PEAK_FORMAT_UINT16) {
av_log(s, AV_LOG_ERROR,
"Writing 16 bit peak for 8 bit audio does not make sense\n");
return AVERROR(EINVAL);
}
wav->peak_maxpos = av_mallocz(enc->channels * sizeof(*wav->peak_maxpos));
if (!wav->peak_maxpos)
goto nomem;
wav->peak_maxneg = av_mallocz(enc->channels * sizeof(*wav->peak_maxneg));
if (!wav->peak_maxneg)
goto nomem;
wav->peak_output = av_malloc(PEAK_BUFFER_SIZE);
if (!wav->peak_output)
goto nomem;
wav->peak_outbuf_size = PEAK_BUFFER_SIZE;
return 0;
nomem:
av_log(s, AV_LOG_ERROR, "Out of memory\n");
peak_free_buffers(s);
return AVERROR(ENOMEM);
}
| 1
|
75,747
|
static bool code_segment_valid(struct kvm_vcpu *vcpu)
{
struct kvm_segment cs;
unsigned int cs_rpl;
vmx_get_segment(vcpu, &cs, VCPU_SREG_CS);
cs_rpl = cs.selector & SELECTOR_RPL_MASK;
if (cs.unusable)
return false;
if (~cs.type & (AR_TYPE_CODE_MASK|AR_TYPE_ACCESSES_MASK))
return false;
if (!cs.s)
return false;
if (cs.type & AR_TYPE_WRITEABLE_MASK) {
if (cs.dpl > cs_rpl)
return false;
} else {
if (cs.dpl != cs_rpl)
return false;
}
if (!cs.present)
return false;
/* TODO: Add Reserved field check, this'll require a new member in the kvm_segment_field structure */
return true;
}
| 0
|
467,087
|
parse_create_repinfo(struct msg_parse* msg, struct reply_info** rep,
struct regional* region)
{
*rep = construct_reply_info_base(region, msg->flags, msg->qdcount, 0,
0, 0, msg->an_rrsets, msg->ns_rrsets, msg->ar_rrsets,
msg->rrset_count, sec_status_unchecked);
if(!*rep)
return 0;
return 1;
}
| 0
|
134,613
|
static int nfs_inode_attrs_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
{
const struct nfs_inode *nfsi = NFS_I(inode);
return ((long)fattr->gencount - (long)nfsi->attr_gencount) > 0 ||
nfs_ctime_need_update(inode, fattr) ||
nfs_size_need_update(inode, fattr) ||
((long)nfsi->attr_gencount - (long)nfs_read_attr_generation_counter() > 0);
}
| 0
|
330,611
|
static double lfo_get_value(SimpleLFO *lfo)
{
double phs = FFMIN(100, lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset);
double val;
if (phs > 1)
phs = fmod(phs, 1.);
switch (lfo->mode) {
case SINE:
val = sin(phs * 2 * M_PI);
break;
case TRIANGLE:
if (phs > 0.75)
val = (phs - 0.75) * 4 - 1;
else if (phs > 0.25)
val = -4 * phs + 2;
else
val = phs * 4;
break;
case SQUARE:
val = phs < 0.5 ? -1 : +1;
break;
case SAWUP:
val = phs * 2 - 1;
break;
case SAWDOWN:
val = 1 - phs * 2;
break;
}
return val * lfo->amount;
}
| 1
|
1,956
|
static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
struct userfaultfd_wait_queue *ewq)
{
if (WARN_ON_ONCE(current->flags & PF_EXITING))
goto out;
ewq->ctx = ctx;
init_waitqueue_entry(&ewq->wq, current);
spin_lock(&ctx->event_wqh.lock);
/*
* After the __add_wait_queue the uwq is visible to userland
* through poll/read().
*/
__add_wait_queue(&ctx->event_wqh, &ewq->wq);
for (;;) {
set_current_state(TASK_KILLABLE);
if (ewq->msg.event == 0)
break;
if (ACCESS_ONCE(ctx->released) ||
fatal_signal_pending(current)) {
__remove_wait_queue(&ctx->event_wqh, &ewq->wq);
if (ewq->msg.event == UFFD_EVENT_FORK) {
struct userfaultfd_ctx *new;
new = (struct userfaultfd_ctx *)
(unsigned long)
ewq->msg.arg.reserved.reserved1;
userfaultfd_ctx_put(new);
}
break;
}
spin_unlock(&ctx->event_wqh.lock);
wake_up_poll(&ctx->fd_wqh, POLLIN);
schedule();
spin_lock(&ctx->event_wqh.lock);
}
__set_current_state(TASK_RUNNING);
spin_unlock(&ctx->event_wqh.lock);
/*
* ctx may go away after this if the userfault pseudo fd is
* already released.
*/
out:
userfaultfd_ctx_put(ctx);
}
| 1
|
309,668
|
void NavigateToDataURLAndCheckForTerminationDisabler(
Shell* shell,
const std::string& html,
bool expect_onunload,
bool expect_onbeforeunload) {
NavigateToURL(shell, GURL("data:text/html," + html));
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(shell->web_contents()->GetMainFrame());
EXPECT_EQ(expect_onunload,
rfh->GetSuddenTerminationDisablerState(blink::kUnloadHandler));
EXPECT_EQ(expect_onbeforeunload, rfh->GetSuddenTerminationDisablerState(
blink::kBeforeUnloadHandler));
}
| 0
|
440,796
|
static int vxlan_fdb_notify_one(struct notifier_block *nb,
const struct vxlan_dev *vxlan,
const struct vxlan_fdb *f,
const struct vxlan_rdst *rdst,
struct netlink_ext_ack *extack)
{
struct switchdev_notifier_vxlan_fdb_info fdb_info;
int rc;
vxlan_fdb_switchdev_notifier_info(vxlan, f, rdst, extack, &fdb_info);
rc = nb->notifier_call(nb, SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE,
&fdb_info);
return notifier_to_errno(rc);
}
| 0
|
124,528
|
static int fill_note_info(struct elfhdr *elf, int phdrs,
struct elf_note_info *info,
long signr, struct pt_regs *regs)
{
struct list_head *t;
if (!elf_note_info_init(info))
return 0;
if (signr) {
struct core_thread *ct;
struct elf_thread_status *ets;
for (ct = current->mm->core_state->dumper.next;
ct; ct = ct->next) {
ets = kzalloc(sizeof(*ets), GFP_KERNEL);
if (!ets)
return 0;
ets->thread = ct->task;
list_add(&ets->list, &info->thread_list);
}
list_for_each(t, &info->thread_list) {
int sz;
ets = list_entry(t, struct elf_thread_status, list);
sz = elf_dump_thread_status(signr, ets);
info->thread_status_size += sz;
}
}
/* now collect the dump for the current */
memset(info->prstatus, 0, sizeof(*info->prstatus));
fill_prstatus(info->prstatus, current, signr);
elf_core_copy_regs(&info->prstatus->pr_reg, regs);
/* Set up header */
fill_elf_header(elf, phdrs, ELF_ARCH, ELF_CORE_EFLAGS, ELF_OSABI);
/*
* Set up the notes in similar form to SVR4 core dumps made
* with info from their /proc.
*/
fill_note(info->notes + 0, "CORE", NT_PRSTATUS,
sizeof(*info->prstatus), info->prstatus);
fill_psinfo(info->psinfo, current->group_leader, current->mm);
fill_note(info->notes + 1, "CORE", NT_PRPSINFO,
sizeof(*info->psinfo), info->psinfo);
info->numnote = 2;
fill_auxv_note(&info->notes[info->numnote++], current->mm);
/* Try to dump the FPU. */
info->prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, regs,
info->fpu);
if (info->prstatus->pr_fpvalid)
fill_note(info->notes + info->numnote++,
"CORE", NT_PRFPREG, sizeof(*info->fpu), info->fpu);
#ifdef ELF_CORE_COPY_XFPREGS
if (elf_core_copy_task_xfpregs(current, info->xfpu))
fill_note(info->notes + info->numnote++,
"LINUX", ELF_CORE_XFPREG_TYPE,
sizeof(*info->xfpu), info->xfpu);
#endif
return 1;
}
| 0
|
13,461
|
_gcry_ecc_eddsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
gcry_mpi_t r_r, gcry_mpi_t s, int hashalgo, gcry_mpi_t pk)
{
int rc;
mpi_ec_t ctx = NULL;
int b;
unsigned int tmp;
unsigned char *digest = NULL;
gcry_buffer_t hvec[3];
const void *mbuf;
size_t mlen;
unsigned char *rawmpi = NULL;
unsigned int rawmpilen;
unsigned char *encpk = NULL; /* Encoded public key. */
unsigned int encpklen;
mpi_point_struct I; /* Intermediate value. */
mpi_point_struct Q; /* Public key. */
gcry_mpi_t a, x, y, r;
memset (hvec, 0, sizeof hvec);
if (!mpi_is_opaque (input))
return GPG_ERR_INV_DATA;
/* Initialize some helpers. */
point_init (&I);
point_init (&Q);
a = mpi_snew (0);
x = mpi_new (0);
y = mpi_new (0);
r = mpi_new (0);
ctx = _gcry_mpi_ec_p_internal_new (skey->E.model, skey->E.dialect, 0,
skey->E.p, skey->E.a, skey->E.b);
b = (ctx->nbits+7)/8;
if (b != 256/8) {
rc = GPG_ERR_INTERNAL; /* We only support 256 bit. */
goto leave;
}
rc = _gcry_ecc_eddsa_compute_h_d (&digest, skey->d, ctx);
if (rc)
goto leave;
_gcry_mpi_set_buffer (a, digest, 32, 0);
/* Compute the public key if it has not been supplied as optional
parameter. */
if (pk)
{
rc = _gcry_ecc_eddsa_decodepoint (pk, ctx, &Q, &encpk, &encpklen);
if (rc)
goto leave;
if (DBG_CIPHER)
log_printhex ("* e_pk", encpk, encpklen);
if (!_gcry_mpi_ec_curve_point (&Q, ctx))
{
rc = GPG_ERR_BROKEN_PUBKEY;
goto leave;
}
}
else
{
_gcry_mpi_ec_mul_point (&Q, a, &skey->E.G, ctx);
rc = _gcry_ecc_eddsa_encodepoint (&Q, ctx, x, y, 0, &encpk, &encpklen);
if (rc)
goto leave;
if (DBG_CIPHER)
log_printhex (" e_pk", encpk, encpklen);
}
/* Compute R. */
mbuf = mpi_get_opaque (input, &tmp);
mlen = (tmp +7)/8;
if (DBG_CIPHER)
log_printhex (" m", mbuf, mlen);
hvec[0].data = digest;
hvec[0].off = 32;
hvec[0].len = 32;
hvec[1].data = (char*)mbuf;
hvec[1].len = mlen;
rc = _gcry_md_hash_buffers (hashalgo, 0, digest, hvec, 2);
if (rc)
goto leave;
reverse_buffer (digest, 64);
if (DBG_CIPHER)
log_printhex (" r", digest, 64);
_gcry_mpi_set_buffer (r, digest, 64, 0);
_gcry_mpi_ec_mul_point (&I, r, &skey->E.G, ctx);
if (DBG_CIPHER)
log_printpnt (" r", &I, ctx);
/* Convert R into affine coordinates and apply encoding. */
rc = _gcry_ecc_eddsa_encodepoint (&I, ctx, x, y, 0, &rawmpi, &rawmpilen);
if (rc)
goto leave;
if (DBG_CIPHER)
log_printhex (" e_r", rawmpi, rawmpilen);
/* S = r + a * H(encodepoint(R) + encodepoint(pk) + m) mod n */
hvec[0].data = rawmpi; /* (this is R) */
hvec[0].off = 0;
hvec[0].len = rawmpilen;
hvec[1].data = encpk;
hvec[1].off = 0;
hvec[1].len = encpklen;
hvec[2].data = (char*)mbuf;
hvec[2].off = 0;
hvec[2].len = mlen;
rc = _gcry_md_hash_buffers (hashalgo, 0, digest, hvec, 3);
if (rc)
goto leave;
/* No more need for RAWMPI thus we now transfer it to R_R. */
mpi_set_opaque (r_r, rawmpi, rawmpilen*8);
rawmpi = NULL;
reverse_buffer (digest, 64);
if (DBG_CIPHER)
log_printhex (" H(R+)", digest, 64);
_gcry_mpi_set_buffer (s, digest, 64, 0);
mpi_mulm (s, s, a, skey->E.n);
mpi_addm (s, s, r, skey->E.n);
rc = eddsa_encodempi (s, b, &rawmpi, &rawmpilen);
if (rc)
goto leave;
if (DBG_CIPHER)
log_printhex (" e_s", rawmpi, rawmpilen);
mpi_set_opaque (s, rawmpi, rawmpilen*8);
rawmpi = NULL;
rc = 0;
leave:
_gcry_mpi_release (a);
_gcry_mpi_release (x);
_gcry_mpi_release (y);
_gcry_mpi_release (r);
xfree (digest);
_gcry_mpi_ec_free (ctx);
point_free (&I);
point_free (&Q);
xfree (encpk);
xfree (rawmpi);
return rc;
}
| 1
|
123,719
|
static ssize_t regulator_print_state(char *buf, int state)
{
if (state > 0)
return sprintf(buf, "enabled\n");
else if (state == 0)
return sprintf(buf, "disabled\n");
else
return sprintf(buf, "unknown\n");
}
| 0
|
35,296
|
**/
CImgDisplay(const unsigned int width, const unsigned int height,
const char *const title=0, const unsigned int normalization=3,
const bool is_fullscreen=false, const bool is_closed=false):
_width(0),_height(0),_normalization(0),
_min(0),_max(0),
_is_fullscreen(false),
_title(0),
_window_width(0),_window_height(0),_button(0),
_keys(new unsigned int[128]),_released_keys(new unsigned int[128]),
_window_x(0),_window_y(0),_mouse_x(-1),_mouse_y(-1),_wheel(0),
_is_closed(true),_is_resized(false),_is_moved(false),_is_event(false) {
assign(width,height,title,normalization,is_fullscreen,is_closed);
| 0
|
359,961
|
deep_count_one (DeepCountState *state,
GFileInfo *info)
{
NautilusFile *file;
GFile *subdir;
gboolean is_seen_inode;
if (should_skip_file (NULL, info)) {
return;
}
is_seen_inode = seen_inode (state, info);
if (!is_seen_inode) {
mark_inode_as_seen (state, info);
}
file = state->directory->details->deep_count_file;
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
/* Count the directory. */
file->details->deep_directory_count += 1;
/* Record the fact that we have to descend into this directory. */
subdir = g_file_get_child (state->deep_count_location, g_file_info_get_name (info));
state->deep_count_subdirectories = g_list_prepend
(state->deep_count_subdirectories, subdir);
} else {
/* Even non-regular files count as files. */
file->details->deep_file_count += 1;
}
/* Count the size. */
if (!is_seen_inode && g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE)) {
file->details->deep_size += g_file_info_get_size (info);
}
}
| 0
|
488,380
|
int __init igmp6_late_init(void)
{
return register_netdevice_notifier(&igmp6_netdev_notifier);
}
| 0
|
396,508
|
searchAnchor(AnchorList *al, char *str)
{
int i;
Anchor *a;
if (al == NULL)
return NULL;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
if (a->hseq < 0)
continue;
if (!strcmp(a->url, str))
return a;
}
return NULL;
}
| 0
|
260,603
|
xfs_buf_vmap_len(
struct xfs_buf *bp)
{
return (bp->b_page_count * PAGE_SIZE) - bp->b_offset;
}
| 0
|
66,359
|
void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
time_t t)
{
X509_VERIFY_PARAM_set_time(ctx->param, t);
}
| 0
|
405,329
|
void __init mem_init_print_info(const char *str)
{
unsigned long physpages, codesize, datasize, rosize, bss_size;
unsigned long init_code_size, init_data_size;
physpages = get_num_physpages();
codesize = _etext - _stext;
datasize = _edata - _sdata;
rosize = __end_rodata - __start_rodata;
bss_size = __bss_stop - __bss_start;
init_data_size = __init_end - __init_begin;
init_code_size = _einittext - _sinittext;
/*
* Detect special cases and adjust section sizes accordingly:
* 1) .init.* may be embedded into .data sections
* 2) .init.text.* may be out of [__init_begin, __init_end],
* please refer to arch/tile/kernel/vmlinux.lds.S.
* 3) .rodata.* may be embedded into .text or .data sections.
*/
#define adj_init_size(start, end, size, pos, adj) \
do { \
if (start <= pos && pos < end && size > adj) \
size -= adj; \
} while (0)
adj_init_size(__init_begin, __init_end, init_data_size,
_sinittext, init_code_size);
adj_init_size(_stext, _etext, codesize, _sinittext, init_code_size);
adj_init_size(_sdata, _edata, datasize, __init_begin, init_data_size);
adj_init_size(_stext, _etext, codesize, __start_rodata, rosize);
adj_init_size(_sdata, _edata, datasize, __start_rodata, rosize);
#undef adj_init_size
pr_info("Memory: %luK/%luK available (%luK kernel code, %luK rwdata, %luK rodata, %luK init, %luK bss, %luK reserved, %luK cma-reserved"
#ifdef CONFIG_HIGHMEM
", %luK highmem"
#endif
"%s%s)\n",
nr_free_pages() << (PAGE_SHIFT - 10),
physpages << (PAGE_SHIFT - 10),
codesize >> 10, datasize >> 10, rosize >> 10,
(init_data_size + init_code_size) >> 10, bss_size >> 10,
(physpages - totalram_pages - totalcma_pages) << (PAGE_SHIFT - 10),
totalcma_pages << (PAGE_SHIFT - 10),
#ifdef CONFIG_HIGHMEM
totalhigh_pages << (PAGE_SHIFT - 10),
#endif
str ? ", " : "", str ? str : "");
}
| 0
|
201,789
|
pgp_get_data(sc_card_t *card, unsigned int tag, u8 *buf, size_t buf_len)
{
sc_apdu_t apdu;
int r;
LOG_FUNC_CALLED(card->ctx);
sc_format_apdu(card, &apdu, SC_APDU_CASE_2, 0xCA, tag >> 8, tag);
apdu.le = ((buf_len >= 256) && !(card->caps & SC_CARD_CAP_APDU_EXT)) ? 256 : buf_len;
apdu.resp = buf;
apdu.resplen = buf_len;
r = sc_transmit_apdu(card, &apdu);
LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
/* For Gnuk card, if there is no certificate, it returns error instead of empty data.
* So, for this case, we ignore error and consider success */
if (r == SC_ERROR_DATA_OBJECT_NOT_FOUND && card->type == SC_CARD_TYPE_OPENPGP_GNUK
&& (tag == DO_CERT || tag == DO_PRIV1 || tag == DO_PRIV2 || tag == DO_PRIV3 || tag == DO_PRIV4)) {
r = SC_SUCCESS;
apdu.resplen = 0;
}
LOG_TEST_RET(card->ctx, r, "Card returned error");
LOG_FUNC_RETURN(card->ctx, (int)apdu.resplen);
}
| 0
|
292,960
|
compile_assign_unlet(
char_u *var_start,
lhs_T *lhs,
int is_assign,
type_T *rhs_type,
cctx_T *cctx)
{
vartype_T dest_type;
garray_T *stack = &cctx->ctx_type_stack;
int range = FALSE;
if (compile_assign_index(var_start, lhs, &range, cctx) == FAIL)
return FAIL;
if (is_assign && range
&& lhs->lhs_type->tt_type != VAR_LIST
&& lhs->lhs_type != &t_blob
&& lhs->lhs_type != &t_any)
{
semsg(_(e_cannot_use_range_with_assignment_str), var_start);
return FAIL;
}
if (lhs->lhs_type == &t_any)
{
// Index on variable of unknown type: check at runtime.
dest_type = VAR_ANY;
}
else
{
dest_type = lhs->lhs_type->tt_type;
if (dest_type == VAR_DICT && range)
{
emsg(e_cannot_use_range_with_dictionary);
return FAIL;
}
if (dest_type == VAR_DICT
&& may_generate_2STRING(-1, FALSE, cctx) == FAIL)
return FAIL;
if (dest_type == VAR_LIST || dest_type == VAR_BLOB)
{
type_T *type;
if (range)
{
type = ((type_T **)stack->ga_data)[stack->ga_len - 2];
if (need_type(type, &t_number,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;
}
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
if ((dest_type != VAR_BLOB && type != &t_special)
&& need_type(type, &t_number,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return FAIL;
}
}
// Load the dict or list. On the stack we then have:
// - value (for assignment, not for :unlet)
// - index
// - for [a : b] second index
// - variable
if (compile_load_lhs(lhs, var_start, rhs_type, cctx) == FAIL)
return FAIL;
if (dest_type == VAR_LIST || dest_type == VAR_DICT
|| dest_type == VAR_BLOB || dest_type == VAR_ANY)
{
if (is_assign)
{
if (range)
{
if (generate_instr_drop(cctx, ISN_STORERANGE, 4) == NULL)
return FAIL;
}
else
{
isn_T *isn = generate_instr_drop(cctx, ISN_STOREINDEX, 3);
if (isn == NULL)
return FAIL;
isn->isn_arg.vartype = dest_type;
}
}
else if (range)
{
if (generate_instr_drop(cctx, ISN_UNLETRANGE, 3) == NULL)
return FAIL;
}
else
{
if (generate_instr_drop(cctx, ISN_UNLETINDEX, 2) == NULL)
return FAIL;
}
}
else
{
emsg(_(e_indexable_type_required));
return FAIL;
}
return OK;
}
| 0
|
320,088
|
static void test_visitor_in_number(TestInputVisitorData *data,
const void *unused)
{
double res = 0, value = 3.14;
Visitor *v;
v = visitor_input_test_init(data, "%f", value);
visit_type_number(v, NULL, &res, &error_abort);
g_assert_cmpfloat(res, ==, value);
}
| 0
|
392,342
|
bool primality_test(const BigInt& n,
RandomNumberGenerator& rng,
size_t level)
{
const size_t PREF_NONCE_BITS = 128;
if(n == 2)
return true;
if(n <= 1 || n.is_even())
return false;
// Fast path testing for small numbers (<= 65521)
if(n <= PRIMES[PRIME_TABLE_SIZE-1])
{
const word num = n.word_at(0);
for(size_t i = 0; PRIMES[i]; ++i)
{
if(num == PRIMES[i])
return true;
if(num < PRIMES[i])
return false;
}
return false;
}
if(level > 2)
level = 2;
const size_t NONCE_BITS = std::min(n.bits() - 2, PREF_NONCE_BITS);
MillerRabin_Test mr(n);
if(mr.is_witness(2))
return false;
const size_t tests = miller_rabin_test_iterations(n.bits(), level);
for(size_t i = 0; i != tests; ++i)
{
BigInt nonce;
while(nonce < 2 || nonce >= (n-1))
nonce.randomize(rng, NONCE_BITS);
if(mr.is_witness(nonce))
return false;
}
return true;
}
| 0
|
17,079
|
static cmsBool Type_Dictionary_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsHANDLE hDict = ( cmsHANDLE ) Ptr ;
const cmsDICTentry * p ;
cmsBool AnyName , AnyValue ;
cmsUInt32Number i , Count , Length ;
cmsUInt32Number DirectoryPos , CurrentPos , BaseOffset ;
_cmsDICarray a ;
if ( hDict == NULL ) return FALSE ;
BaseOffset = io -> Tell ( io ) - sizeof ( _cmsTagBase ) ;
Count = 0 ;
AnyName = FALSE ;
AnyValue = FALSE ;
for ( p = cmsDictGetEntryList ( hDict ) ;
p != NULL ;
p = cmsDictNextEntry ( p ) ) {
if ( p -> DisplayName != NULL ) AnyName = TRUE ;
if ( p -> DisplayValue != NULL ) AnyValue = TRUE ;
Count ++ ;
}
Length = 16 ;
if ( AnyName ) Length += 8 ;
if ( AnyValue ) Length += 8 ;
if ( ! _cmsWriteUInt32Number ( io , Count ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , Length ) ) return FALSE ;
DirectoryPos = io -> Tell ( io ) ;
if ( ! AllocArray ( self -> ContextID , & a , Count , Length ) ) goto Error ;
if ( ! WriteOffsetArray ( io , & a , Count , Length ) ) goto Error ;
p = cmsDictGetEntryList ( hDict ) ;
for ( i = 0 ;
i < Count ;
i ++ ) {
if ( ! WriteOneWChar ( io , & a . Name , i , p -> Name , BaseOffset ) ) goto Error ;
if ( ! WriteOneWChar ( io , & a . Value , i , p -> Value , BaseOffset ) ) goto Error ;
if ( p -> DisplayName != NULL ) {
if ( ! WriteOneMLUC ( self , io , & a . DisplayName , i , p -> DisplayName , BaseOffset ) ) goto Error ;
}
if ( p -> DisplayValue != NULL ) {
if ( ! WriteOneMLUC ( self , io , & a . DisplayValue , i , p -> DisplayValue , BaseOffset ) ) goto Error ;
}
p = cmsDictNextEntry ( p ) ;
}
CurrentPos = io -> Tell ( io ) ;
if ( ! io -> Seek ( io , DirectoryPos ) ) goto Error ;
if ( ! WriteOffsetArray ( io , & a , Count , Length ) ) goto Error ;
if ( ! io -> Seek ( io , CurrentPos ) ) goto Error ;
FreeArray ( & a ) ;
return TRUE ;
Error : FreeArray ( & a ) ;
return FALSE ;
cmsUNUSED_PARAMETER ( nItems ) ;
}
| 0
|
191,825
|
void GfxColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange,
int maxImgPixel) {
int i;
for (i = 0; i < getNComps(); ++i) {
decodeLow[i] = 0;
decodeRange[i] = 1;
}
}
| 0
|
304,723
|
static int ssl_parse_server_psk_hint( mbedtls_ssl_context *ssl,
unsigned char **p,
unsigned char *end )
{
int ret = MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
size_t len;
((void) ssl);
/*
* PSK parameters:
*
* opaque psk_identity_hint<0..2^16-1>;
*/
if( (*p) > end - 2 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
"(psk_identity_hint length)" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
len = (*p)[0] << 8 | (*p)[1];
*p += 2;
if( (*p) > end - len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message "
"(psk_identity_hint length)" ) );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
/*
* Note: we currently ignore the PKS identity hint, as we only allow one
* PSK to be provisionned on the client. This could be changed later if
* someone needs that feature.
*/
*p += len;
ret = 0;
return( ret );
}
| 0
|
49,219
|
int mingw_listen(int sockfd, int backlog)
{
SOCKET s = (SOCKET)_get_osfhandle(sockfd);
return listen(s, backlog);
}
| 0
|
175,011
|
dict_threshold2_params(const ref * pdict, gs_threshold2_halftone * ptp,
ref * ptproc, gs_memory_t *mem)
{
ref *tstring;
int code =
dict_threshold_common_params(pdict,
(gs_threshold_halftone_common *)ptp,
&tstring, ptproc);
int bps;
uint size;
int cw2, ch2;
if (code < 0 ||
(code = cw2 = dict_int_param(pdict, "Width2", 0, 0x7fff, 0,
&ptp->width2)) < 0 ||
(code = ch2 = dict_int_param(pdict, "Height2", 0, 0x7fff, 0,
&ptp->height2)) < 0 ||
(code = dict_int_param(pdict, "BitsPerSample", 8, 16, -1, &bps)) < 0
)
return code;
if ((bps != 8 && bps != 16) || cw2 != ch2 ||
(!cw2 && (ptp->width2 == 0 || ptp->height2 == 0))
)
return_error(gs_error_rangecheck);
ptp->bytes_per_sample = bps / 8;
switch (r_type(tstring)) {
case t_string:
size = r_size(tstring);
gs_bytestring_from_string(&ptp->thresholds, tstring->value.const_bytes,
size);
break;
case t_astruct:
if (gs_object_type(mem, tstring->value.pstruct) != &st_bytes)
return_error(gs_error_typecheck);
size = gs_object_size(mem, tstring->value.pstruct);
gs_bytestring_from_bytes(&ptp->thresholds, r_ptr(tstring, byte),
0, size);
break;
default:
return_error(gs_error_typecheck);
}
check_read(*tstring);
if (size != (ptp->width * ptp->height + ptp->width2 * ptp->height2) *
ptp->bytes_per_sample)
return_error(gs_error_rangecheck);
return 0;
}
| 0
|
388,398
|
int LibRaw::subtract_black_internal()
{
CHECK_ORDER_LOW(LIBRAW_PROGRESS_RAW2_IMAGE);
try {
if(!is_phaseone_compressed() && (C.cblack[0] || C.cblack[1] || C.cblack[2] || C.cblack[3] || (C.cblack[4] && C.cblack[5]) ))
{
#define BAYERC(row,col,c) imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][c]
int cblk[4],i;
for(i=0;i<4;i++)
cblk[i] = C.cblack[i];
int size = S.iheight * S.iwidth;
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define LIM(x,min,max) MAX(min,MIN(x,max))
#define CLIP(x) LIM(x,0,65535)
int dmax = 0;
if(C.cblack[4] && C.cblack[5])
{
for(i=0; i< size*4; i++)
{
int val = imgdata.image[0][i];
val -= C.cblack[6 + i/4 / S.iwidth % C.cblack[4] * C.cblack[5] +
i/4 % S.iwidth % C.cblack[5]];
val -= cblk[i & 3];
imgdata.image[0][i] = CLIP(val);
if(dmax < val) dmax = val;
}
}
else
{
for(i=0; i< size*4; i++)
{
int val = imgdata.image[0][i];
val -= cblk[i & 3];
imgdata.image[0][i] = CLIP(val);
if(dmax < val) dmax = val;
}
}
C.data_maximum = dmax & 0xffff;
#undef MIN
#undef MAX
#undef LIM
#undef CLIP
C.maximum -= C.black;
ZERO(C.cblack); // Yeah, we used cblack[6+] values too!
C.black = 0;
#undef BAYERC
}
else
{
// Nothing to Do, maximum is already calculated, black level is 0, so no change
// only calculate channel maximum;
int idx;
ushort *p = (ushort*)imgdata.image;
int dmax = 0;
for(idx=0;idx<S.iheight*S.iwidth*4;idx++)
if(dmax < p[idx]) dmax = p[idx];
C.data_maximum = dmax;
}
return 0;
}
catch ( LibRaw_exceptions err) {
EXCEPTION_HANDLER(err);
}
}
| 0
|
371,761
|
file_leave_notify_callback (GtkWidget *widget,
GdkEventCrossing *event,
gpointer user_data)
{
FrWindow *window = user_data;
GtkTreeIter iter;
if (window->priv->single_click && (window->priv->list_hover_path != NULL)) {
gtk_tree_model_get_iter (GTK_TREE_MODEL (window->priv->list_store),
&iter,
window->priv->list_hover_path);
gtk_tree_model_row_changed (GTK_TREE_MODEL (window->priv->list_store),
window->priv->list_hover_path,
&iter);
gtk_tree_path_free (window->priv->list_hover_path);
window->priv->list_hover_path = NULL;
}
return FALSE;
}
| 0
|
218,923
|
blink::WebSpeechRecognizer* RenderViewImpl::SpeechRecognizer() {
if (!speech_recognition_dispatcher_)
speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this);
return speech_recognition_dispatcher_;
}
| 0
|
201,518
|
long long jsvGetLongIntegerAndUnLock(JsVar *v) {
long long i = jsvGetLongInteger(v);
jsvUnLock(v);
return i;
}
| 0
|
451,661
|
static inline void bvec_advance(const struct bio_vec *bvec,
struct bvec_iter_all *iter_all)
{
struct bio_vec *bv = &iter_all->bv;
if (iter_all->done) {
bv->bv_page++;
bv->bv_offset = 0;
} else {
bv->bv_page = bvec->bv_page + (bvec->bv_offset >> PAGE_SHIFT);
bv->bv_offset = bvec->bv_offset & ~PAGE_MASK;
}
bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset,
bvec->bv_len - iter_all->done);
iter_all->done += bv->bv_len;
if (iter_all->done == bvec->bv_len) {
iter_all->idx++;
iter_all->done = 0;
}
}
| 0
|
255,072
|
int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type)
{
struct hexline *hx;
u8 reset;
int ret,pos=0;
hx = kmalloc(sizeof(*hx), GFP_KERNEL);
if (!hx)
return -ENOMEM;
/* stop the CPU */
reset = 1;
if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1)
err("could not stop the USB controller CPU.");
while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) {
deb_fw("writing to address 0x%04x (buffer: 0x%02x %02x)\n", hx->addr, hx->len, hx->chk);
ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len);
if (ret != hx->len) {
err("error while transferring firmware (transferred size: %d, block size: %d)",
ret, hx->len);
ret = -EINVAL;
break;
}
}
if (ret < 0) {
err("firmware download failed at %d with %d",pos,ret);
kfree(hx);
return ret;
}
if (ret == 0) {
/* restart the CPU */
reset = 0;
if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) {
err("could not restart the USB controller CPU.");
ret = -EINVAL;
}
} else
ret = -EIO;
kfree(hx);
return ret;
}
| 1
|
47,262
|
static void nfp_flower_vnic_clean(struct nfp_app *app, struct nfp_net *nn)
{
struct nfp_flower_priv *priv = app->priv;
if (app->pf->num_vfs)
nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_VF);
nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PF);
nfp_reprs_clean_and_free_by_type(app, NFP_REPR_TYPE_PHYS_PORT);
priv->nn = NULL;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.