unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
74,734 | 0 | void kernel_bad_stack(struct pt_regs *regs)
{
printk(KERN_EMERG "Bad kernel stack pointer %lx at %lx\n",
regs->gpr[1], regs->nip);
die("Bad kernel stack pointer", regs, SIGABRT);
}
| 3,600 |
57,454 | 0 | void ext4_ext_truncate(struct inode *inode)
{
struct address_space *mapping = inode->i_mapping;
struct super_block *sb = inode->i_sb;
ext4_lblk_t last_block;
handle_t *handle;
int err = 0;
/*
* probably first extent we're gonna free will be last in block
*/
err = ext4_writepage_trans_blocks(inode);
handle = ext4_journal_start(inode, err);
if (IS_ERR(handle))
return;
if (inode->i_size & (sb->s_blocksize - 1))
ext4_block_truncate_page(handle, mapping, inode->i_size);
if (ext4_orphan_add(handle, inode))
goto out_stop;
down_write(&EXT4_I(inode)->i_data_sem);
ext4_ext_invalidate_cache(inode);
ext4_discard_preallocations(inode);
/*
* TODO: optimization is possible here.
* Probably we need not scan at all,
* because page truncation is enough.
*/
/* we have to know where to truncate from in crash case */
EXT4_I(inode)->i_disksize = inode->i_size;
ext4_mark_inode_dirty(handle, inode);
last_block = (inode->i_size + sb->s_blocksize - 1)
>> EXT4_BLOCK_SIZE_BITS(sb);
err = ext4_ext_remove_space(inode, last_block);
/* In a multi-transaction truncate, we only make the final
* transaction synchronous.
*/
if (IS_SYNC(inode))
ext4_handle_sync(handle);
out_stop:
up_write(&EXT4_I(inode)->i_data_sem);
/*
* If this was a simple ftruncate() and the file will remain alive,
* then we need to clear up the orphan record which we created above.
* However, if this was a real unlink then we were called by
* ext4_delete_inode(), and we allow that function to clean up the
* orphan info for us.
*/
if (inode->i_nlink)
ext4_orphan_del(handle, inode);
inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
ext4_mark_inode_dirty(handle, inode);
ext4_journal_stop(handle);
}
| 3,601 |
7,467 | 0 | t1_decoder_init( T1_Decoder decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
PS_Blend blend,
FT_Bool hinting,
FT_Render_Mode hint_mode,
T1_Decoder_Callback parse_callback )
{
FT_ZERO( decoder );
/* retrieve PSNames interface from list of current modules */
{
FT_Service_PsCMaps psnames;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
if ( !psnames )
{
FT_ERROR(( "t1_decoder_init:"
" the `psnames' module is not available\n" ));
return FT_THROW( Unimplemented_Feature );
}
decoder->psnames = psnames;
}
t1_builder_init( &decoder->builder, face, size, slot, hinting );
/* decoder->buildchar and decoder->len_buildchar have to be */
/* initialized by the caller since we cannot know the length */
/* of the BuildCharArray */
decoder->num_glyphs = (FT_UInt)face->num_glyphs;
decoder->glyph_names = glyph_names;
decoder->hint_mode = hint_mode;
decoder->blend = blend;
decoder->parse_callback = parse_callback;
decoder->funcs = t1_decoder_funcs;
return FT_Err_Ok;
}
| 3,602 |
134,700 | 0 | void SynchronousCompositorImpl::SetClient(
SynchronousCompositorClient* compositor_client) {
DCHECK(CalledOnValidThread());
DCHECK_IMPLIES(compositor_client, !compositor_client_);
DCHECK_IMPLIES(!compositor_client, compositor_client_);
if (!compositor_client) {
SynchronousCompositorRegistry::GetInstance()->UnregisterCompositor(
routing_id_, this);
}
compositor_client_ = compositor_client;
if (compositor_client_) {
SynchronousCompositorRegistry::GetInstance()->RegisterCompositor(
routing_id_, this);
}
}
| 3,603 |
177,996 | 1 | context_length_arg (char const *str, int *out)
{
uintmax_t value;
if (! (xstrtoumax (str, 0, 10, &value, "") == LONGINT_OK
&& 0 <= (*out = value)
&& *out == value))
{
error (EXIT_TROUBLE, 0, "%s: %s", str,
_("invalid context length argument"));
}
page size, unless a read yields a partial page. */
static char *buffer; /* Base of buffer. */
static size_t bufalloc; /* Allocated buffer size, counting slop. */
#define INITIAL_BUFSIZE 32768 /* Initial buffer size, not counting slop. */
static int bufdesc; /* File descriptor. */
static char *bufbeg; /* Beginning of user-visible stuff. */
static char *buflim; /* Limit of user-visible stuff. */
static size_t pagesize; /* alignment of memory pages */
static off_t bufoffset; /* Read offset; defined on regular files. */
static off_t after_last_match; /* Pointer after last matching line that
would have been output if we were
outputting characters. */
/* Return VAL aligned to the next multiple of ALIGNMENT. VAL can be
an integer or a pointer. Both args must be free of side effects. */
#define ALIGN_TO(val, alignment) \
((size_t) (val) % (alignment) == 0 \
? (val) \
: (val) + ((alignment) - (size_t) (val) % (alignment)))
/* Reset the buffer for a new file, returning zero if we should skip it.
Initialize on the first time through. */
static int
reset (int fd, char const *file, struct stats *stats)
{
if (! pagesize)
{
pagesize = getpagesize ();
if (pagesize == 0 || 2 * pagesize + 1 <= pagesize)
abort ();
bufalloc = ALIGN_TO (INITIAL_BUFSIZE, pagesize) + pagesize + 1;
buffer = xmalloc (bufalloc);
}
bufbeg = buflim = ALIGN_TO (buffer + 1, pagesize);
bufbeg[-1] = eolbyte;
bufdesc = fd;
if (S_ISREG (stats->stat.st_mode))
{
if (file)
bufoffset = 0;
else
{
bufoffset = lseek (fd, 0, SEEK_CUR);
if (bufoffset < 0)
{
suppressible_error (_("lseek failed"), errno);
return 0;
}
}
}
return 1;
}
/* Read new stuff into the buffer, saving the specified
amount of old stuff. When we're done, 'bufbeg' points
to the beginning of the buffer contents, and 'buflim'
points just after the end. Return zero if there's an error. */
static int
fillbuf (size_t save, struct stats const *stats)
{
size_t fillsize = 0;
int cc = 1;
char *readbuf;
size_t readsize;
/* Offset from start of buffer to start of old stuff
that we want to save. */
size_t saved_offset = buflim - save - buffer;
if (pagesize <= buffer + bufalloc - buflim)
{
readbuf = buflim;
bufbeg = buflim - save;
}
else
{
size_t minsize = save + pagesize;
size_t newsize;
size_t newalloc;
char *newbuf;
/* Grow newsize until it is at least as great as minsize. */
for (newsize = bufalloc - pagesize - 1; newsize < minsize; newsize *= 2)
if (newsize * 2 < newsize || newsize * 2 + pagesize + 1 < newsize * 2)
xalloc_die ();
/* Try not to allocate more memory than the file size indicates,
as that might cause unnecessary memory exhaustion if the file
is large. However, do not use the original file size as a
heuristic if we've already read past the file end, as most
likely the file is growing. */
if (S_ISREG (stats->stat.st_mode))
{
off_t to_be_read = stats->stat.st_size - bufoffset;
off_t maxsize_off = save + to_be_read;
if (0 <= to_be_read && to_be_read <= maxsize_off
&& maxsize_off == (size_t) maxsize_off
&& minsize <= (size_t) maxsize_off
&& (size_t) maxsize_off < newsize)
newsize = maxsize_off;
}
/* Add enough room so that the buffer is aligned and has room
for byte sentinels fore and aft. */
newalloc = newsize + pagesize + 1;
newbuf = bufalloc < newalloc ? xmalloc (bufalloc = newalloc) : buffer;
readbuf = ALIGN_TO (newbuf + 1 + save, pagesize);
bufbeg = readbuf - save;
memmove (bufbeg, buffer + saved_offset, save);
bufbeg[-1] = eolbyte;
if (newbuf != buffer)
{
free (buffer);
buffer = newbuf;
}
}
readsize = buffer + bufalloc - readbuf;
readsize -= readsize % pagesize;
if (! fillsize)
{
ssize_t bytesread;
while ((bytesread = read (bufdesc, readbuf, readsize)) < 0
&& errno == EINTR)
continue;
if (bytesread < 0)
cc = 0;
else
fillsize = bytesread;
}
bufoffset += fillsize;
#if defined HAVE_DOS_FILE_CONTENTS
if (fillsize)
fillsize = undossify_input (readbuf, fillsize);
#endif
buflim = readbuf + fillsize;
return cc;
}
/* Flags controlling the style of output. */
static enum
{
BINARY_BINARY_FILES,
TEXT_BINARY_FILES,
WITHOUT_MATCH_BINARY_FILES
} binary_files; /* How to handle binary files. */
static int filename_mask; /* If zero, output nulls after filenames. */
static int out_quiet; /* Suppress all normal output. */
static int out_invert; /* Print nonmatching stuff. */
static int out_file; /* Print filenames. */
static int out_line; /* Print line numbers. */
static int out_byte; /* Print byte offsets. */
static int out_before; /* Lines of leading context. */
static int out_after; /* Lines of trailing context. */
static int out_file; /* Print filenames. */
static int out_line; /* Print line numbers. */
static int out_byte; /* Print byte offsets. */
static int out_before; /* Lines of leading context. *
static int out_after; /* Lines of trailing context. *
static int count_matches; /* Count matching lines. */
static int list_files; /* List matching files. */
static int no_filenames; /* Suppress file names. */
static off_t max_count; /* Stop after outputting this many
lines from an input file. */
static int line_buffered; /* If nonzero, use line buffering, i.e.
fflush everyline out. */
static char const *lastnl; /* Pointer after last newline counted. */
static char const *lastout; /* Pointer after last character output;
NULL if no character has been output
or if it's conceptually before bufbeg. */
static uintmax_t totalnl; /* Total newline count before lastnl. */
static off_t outleft; /* Maximum number of lines to be output. */
static int pending; /* Pending lines of output.
NULL if no character has been output
or if it's conceptually before bufbeg. */
static uintmax_t totalnl; /* Total newline count before lastnl. */
static off_t outleft; /* Maximum number of lines to be output. *
static int pending; /* Pending lines of output.
Always kept 0 if out_quiet is true. */
static int done_on_match; /* Stop scanning file on first match. */
static int exit_on_match; /* Exit on first match. */
/* Add two numbers that count input bytes or lines, and report an
error if the addition overflows. */
static uintmax_t
add_count (uintmax_t a, uintmax_t b)
{
uintmax_t sum = a + b;
if (sum < a)
error (EXIT_TROUBLE, 0, _("input is too large to count"));
return sum;
}
static void
nlscan (char const *lim)
{
size_t newlines = 0;
char const *beg;
for (beg = lastnl; beg < lim; beg++)
{
beg = memchr (beg, eolbyte, lim - beg);
if (!beg)
break;
newlines++;
}
totalnl = add_count (totalnl, newlines);
lastnl = lim;
}
/* Print the current filename. */
static void
print_filename (void)
{
pr_sgr_start_if (filename_color);
fputs (filename, stdout);
pr_sgr_end_if (filename_color);
}
/* Print a character separator. */
static void
print_sep (char sep)
{
pr_sgr_start_if (sep_color);
fputc (sep, stdout);
pr_sgr_end_if (sep_color);
}
/* Print a line number or a byte offset. */
static void
print_offset (uintmax_t pos, int min_width, const char *color)
{
/* Do not rely on printf to print pos, since uintmax_t may be longer
than long, and long long is not portable. */
char buf[sizeof pos * CHAR_BIT];
char *p = buf + sizeof buf;
do
{
*--p = '0' + pos % 10;
--min_width;
}
while ((pos /= 10) != 0);
/* Do this to maximize the probability of alignment across lines. */
if (align_tabs)
while (--min_width >= 0)
*--p = ' ';
pr_sgr_start_if (color);
fwrite (p, 1, buf + sizeof buf - p, stdout);
pr_sgr_end_if (color);
}
/* Print a whole line head (filename, line, byte). */
static void
print_line_head (char const *beg, char const *lim, int sep)
{
int pending_sep = 0;
if (out_file)
{
print_filename ();
if (filename_mask)
pending_sep = 1;
else
fputc (0, stdout);
}
if (out_line)
{
if (lastnl < lim)
{
nlscan (beg);
totalnl = add_count (totalnl, 1);
lastnl = lim;
}
if (pending_sep)
print_sep (sep);
print_offset (totalnl, 4, line_num_color);
pending_sep = 1;
}
if (out_byte)
{
uintmax_t pos = add_count (totalcc, beg - bufbeg);
#if defined HAVE_DOS_FILE_CONTENTS
pos = dossified_pos (pos);
#endif
if (pending_sep)
print_sep (sep);
print_offset (pos, 6, byte_num_color);
pending_sep = 1;
}
if (pending_sep)
{
/* This assumes sep is one column wide.
Try doing this any other way with Unicode
(and its combining and wide characters)
filenames and you're wasting your efforts. */
if (align_tabs)
fputs ("\t\b", stdout);
print_sep (sep);
}
}
static const char *
print_line_middle (const char *beg, const char *lim,
const char *line_color, const char *match_color)
{
size_t match_size;
size_t match_offset;
const char *cur = beg;
const char *mid = NULL;
while (cur < lim
&& ((match_offset = execute (beg, lim - beg, &match_size,
beg + (cur - beg))) != (size_t) -1))
{
char const *b = beg + match_offset;
/* Avoid matching the empty line at the end of the buffer. */
if (b == lim)
break;
/* Avoid hanging on grep --color "" foo */
if (match_size == 0)
{
/* Make minimal progress; there may be further non-empty matches. */
/* XXX - Could really advance by one whole multi-octet character. */
match_size = 1;
if (!mid)
mid = cur;
}
else
{
/* This function is called on a matching line only,
but is it selected or rejected/context? */
if (only_matching)
print_line_head (b, lim, (out_invert ? SEP_CHAR_REJECTED
: SEP_CHAR_SELECTED));
else
{
pr_sgr_start (line_color);
if (mid)
{
cur = mid;
mid = NULL;
}
fwrite (cur, sizeof (char), b - cur, stdout);
}
pr_sgr_start_if (match_color);
fwrite (b, sizeof (char), match_size, stdout);
pr_sgr_end_if (match_color);
if (only_matching)
fputs ("\n", stdout);
}
cur = b + match_size;
}
if (only_matching)
cur = lim;
else if (mid)
cur = mid;
return cur;
}
static const char *
print_line_tail (const char *beg, const char *lim, const char *line_color)
{
size_t eol_size;
size_t tail_size;
eol_size = (lim > beg && lim[-1] == eolbyte);
eol_size += (lim - eol_size > beg && lim[-(1 + eol_size)] == '\r');
tail_size = lim - eol_size - beg;
if (tail_size > 0)
{
pr_sgr_start (line_color);
fwrite (beg, 1, tail_size, stdout);
beg += tail_size;
pr_sgr_end (line_color);
}
return beg;
}
static void
prline (char const *beg, char const *lim, int sep)
{
int matching;
const char *line_color;
const char *match_color;
if (!only_matching)
print_line_head (beg, lim, sep);
matching = (sep == SEP_CHAR_SELECTED) ^ !!out_invert;
if (color_option)
{
line_color = (((sep == SEP_CHAR_SELECTED)
^ (out_invert && (color_option < 0)))
? selected_line_color : context_line_color);
match_color = (sep == SEP_CHAR_SELECTED
? selected_match_color : context_match_color);
}
else
line_color = match_color = NULL; /* Shouldn't be used. */
if ((only_matching && matching)
|| (color_option && (*line_color || *match_color)))
{
/* We already know that non-matching lines have no match (to colorize). */
if (matching && (only_matching || *match_color))
beg = print_line_middle (beg, lim, line_color, match_color);
/* FIXME: this test may be removable. */
if (!only_matching && *line_color)
beg = print_line_tail (beg, lim, line_color);
}
if (!only_matching && lim > beg)
fwrite (beg, 1, lim - beg, stdout);
if (ferror (stdout))
{
write_error_seen = 1;
error (EXIT_TROUBLE, 0, _("write error"));
}
lastout = lim;
if (line_buffered)
fflush (stdout);
}
/* Print pending lines of trailing context prior to LIM. Trailing context ends
at the next matching line when OUTLEFT is 0. */
static void
prpending (char const *lim)
{
if (!lastout)
lastout = bufbeg;
while (pending > 0 && lastout < lim)
{
char const *nl = memchr (lastout, eolbyte, lim - lastout);
size_t match_size;
--pending;
if (outleft
|| ((execute (lastout, nl + 1 - lastout,
&match_size, NULL) == (size_t) -1)
== !out_invert))
prline (lastout, nl + 1, SEP_CHAR_REJECTED);
else
pending = 0;
}
}
/* Print the lines between BEG and LIM. Deal with context crap.
If NLINESP is non-null, store a count of lines between BEG and LIM. */
static void
prtext (char const *beg, char const *lim, int *nlinesp)
{
/* Print the lines between BEG and LIM. Deal with context crap.
If NLINESP is non-null, store a count of lines between BEG and LIM. */
static void
prtext (char const *beg, char const *lim, int *nlinesp)
{
static int used; /* avoid printing SEP_STR_GROUP before any output */
char const *bp, *p;
char eol = eolbyte;
int i, n;
if (!out_quiet && pending > 0)
prpending (beg);
/* Deal with leading context crap. */
bp = lastout ? lastout : bufbeg;
for (i = 0; i < out_before; ++i)
if (p > bp)
do
--p;
while (p[-1] != eol);
/* We print the SEP_STR_GROUP separator only if our output is
discontiguous from the last output in the file. */
if ((out_before || out_after) && used && p != lastout && group_separator)
{
pr_sgr_start_if (sep_color);
fputs (group_separator, stdout);
pr_sgr_end_if (sep_color);
fputc ('\n', stdout);
}
while (p < beg)
{
char const *nl = memchr (p, eol, beg - p);
nl++;
prline (p, nl, SEP_CHAR_REJECTED);
p = nl;
}
}
if (nlinesp)
{
/* Caller wants a line count. */
for (n = 0; p < lim && n < outleft; n++)
{
char const *nl = memchr (p, eol, lim - p);
nl++;
if (!out_quiet)
prline (p, nl, SEP_CHAR_SELECTED);
p = nl;
}
*nlinesp = n;
/* relying on it that this function is never called when outleft = 0. */
after_last_match = bufoffset - (buflim - p);
}
else if (!out_quiet)
prline (beg, lim, SEP_CHAR_SELECTED);
pending = out_quiet ? 0 : out_after;
used = 1;
}
static size_t
do_execute (char const *buf, size_t size, size_t *match_size, char const *start_ptr)
{
size_t result;
const char *line_next;
/* With the current implementation, using --ignore-case with a multi-byte
character set is very inefficient when applied to a large buffer
containing many matches. We can avoid much of the wasted effort
by matching line-by-line.
FIXME: this is just an ugly workaround, and it doesn't really
belong here. Also, PCRE is always using this same per-line
matching algorithm. Either we fix -i, or we should refactor
this code---for example, we could add another function pointer
to struct matcher to split the buffer passed to execute. It would
perform the memchr if line-by-line matching is necessary, or just
return buf + size otherwise. */
if (MB_CUR_MAX == 1 || !match_icase)
return execute (buf, size, match_size, start_ptr);
for (line_next = buf; line_next < buf + size; )
{
const char *line_buf = line_next;
const char *line_end = memchr (line_buf, eolbyte, (buf + size) - line_buf);
if (line_end == NULL)
line_next = line_end = buf + size;
else
line_next = line_end + 1;
if (start_ptr && start_ptr >= line_end)
continue;
result = execute (line_buf, line_next - line_buf, match_size, start_ptr);
if (result != (size_t) -1)
return (line_buf - buf) + result;
}
return (size_t) -1;
}
/* Scan the specified portion of the buffer, matching lines (or
between matching lines if OUT_INVERT is true). Return a count of
lines printed. */
static int
grepbuf (char const *beg, char const *lim)
/* Scan the specified portion of the buffer, matching lines (or
between matching lines if OUT_INVERT is true). Return a count of
lines printed. */
static int
grepbuf (char const *beg, char const *lim)
{
int nlines, n;
char const *p;
size_t match_offset;
size_t match_size;
{
char const *b = p + match_offset;
char const *endp = b + match_size;
/* Avoid matching the empty line at the end of the buffer. */
if (b == lim)
break;
if (!out_invert)
{
prtext (b, endp, (int *) 0);
nlines++;
break;
if (!out_invert)
{
prtext (b, endp, (int *) 0);
nlines++;
outleft--;
if (!outleft || done_on_match)
}
}
else if (p < b)
{
prtext (p, b, &n);
nlines += n;
outleft -= n;
if (!outleft)
return nlines;
}
p = endp;
}
if (out_invert && p < lim)
{
prtext (p, lim, &n);
nlines += n;
outleft -= n;
}
return nlines;
}
/* Search a given file. Normally, return a count of lines printed;
but if the file is a directory and we search it recursively, then
return -2 if there was a match, and -1 otherwise. */
static int
grep (int fd, char const *file, struct stats *stats)
/* Search a given file. Normally, return a count of lines printed;
but if the file is a directory and we search it recursively, then
return -2 if there was a match, and -1 otherwise. */
static int
grep (int fd, char const *file, struct stats *stats)
{
int nlines, i;
int not_text;
size_t residue, save;
char oldc;
return 0;
if (file && directories == RECURSE_DIRECTORIES
&& S_ISDIR (stats->stat.st_mode))
{
/* Close fd now, so that we don't open a lot of file descriptors
when we recurse deeply. */
if (close (fd) != 0)
suppressible_error (file, errno);
return grepdir (file, stats) - 2;
}
totalcc = 0;
lastout = 0;
totalnl = 0;
outleft = max_count;
after_last_match = 0;
pending = 0;
nlines = 0;
residue = 0;
save = 0;
if (! fillbuf (save, stats))
{
suppressible_error (filename, errno);
return 0;
}
not_text = (((binary_files == BINARY_BINARY_FILES && !out_quiet)
|| binary_files == WITHOUT_MATCH_BINARY_FILES)
&& memchr (bufbeg, eol ? '\0' : '\200', buflim - bufbeg));
if (not_text && binary_files == WITHOUT_MATCH_BINARY_FILES)
return 0;
done_on_match += not_text;
out_quiet += not_text;
for (;;)
{
lastnl = bufbeg;
if (lastout)
lastout = bufbeg;
beg = bufbeg + save;
/* no more data to scan (eof) except for maybe a residue -> break */
if (beg == buflim)
break;
/* Determine new residue (the length of an incomplete line at the end of
the buffer, 0 means there is no incomplete last line). */
oldc = beg[-1];
beg[-1] = eol;
for (lim = buflim; lim[-1] != eol; lim--)
continue;
beg[-1] = oldc;
if (lim == beg)
lim = beg - residue;
beg -= residue;
residue = buflim - lim;
if (beg < lim)
{
if (outleft)
nlines += grepbuf (beg, lim);
if (pending)
prpending (lim);
if ((!outleft && !pending) || (nlines && done_on_match && !out_invert))
goto finish_grep;
}
/* The last OUT_BEFORE lines at the end of the buffer will be needed as
leading context if there is a matching line at the begin of the
next data. Make beg point to their begin. */
i = 0;
beg = lim;
while (i < out_before && beg > bufbeg && beg != lastout)
{
++i;
do
--beg;
while (beg[-1] != eol);
}
/* detect if leading context is discontinuous from last printed line. */
if (beg != lastout)
lastout = 0;
/* Handle some details and read more data to scan. */
save = residue + lim - beg;
if (out_byte)
totalcc = add_count (totalcc, buflim - bufbeg - save);
if (out_line)
nlscan (beg);
if (! fillbuf (save, stats))
{
suppressible_error (filename, errno);
goto finish_grep;
}
}
if (residue)
{
*buflim++ = eol;
if (outleft)
nlines += grepbuf (bufbeg + save - residue, buflim);
if (pending)
prpending (buflim);
}
finish_grep:
done_on_match -= not_text;
out_quiet -= not_text;
if ((not_text & ~out_quiet) && nlines != 0)
printf (_("Binary file %s matches\n"), filename);
return nlines;
}
static int
grepfile (char const *file, struct stats *stats)
{
int desc;
int count;
int status;
grepfile (char const *file, struct stats *stats)
{
int desc;
int count;
int status;
filename = (file ? file : label ? label : _("(standard input)"));
/* Don't open yet, since that might have side effects on a device. */
desc = -1;
}
else
{
/* When skipping directories, don't worry about directories
that can't be opened. */
desc = open (file, O_RDONLY);
if (desc < 0 && directories != SKIP_DIRECTORIES)
{
suppressible_error (file, errno);
return 1;
}
}
if (desc < 0
? stat (file, &stats->stat) != 0
: fstat (desc, &stats->stat) != 0)
{
suppressible_error (filename, errno);
if (file)
close (desc);
return 1;
}
if ((directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
|| (devices == SKIP_DEVICES && (S_ISCHR (stats->stat.st_mode)
|| S_ISBLK (stats->stat.st_mode)
|| S_ISSOCK (stats->stat.st_mode)
|| S_ISFIFO (stats->stat.st_mode))))
{
if (file)
close (desc);
return 1;
}
/* If there is a regular file on stdout and the current file refers
to the same i-node, we have to report the problem and skip it.
Otherwise when matching lines from some other input reach the
disk before we open this file, we can end up reading and matching
those lines and appending them to the file from which we're reading.
Then we'd have what appears to be an infinite loop that'd terminate
only upon filling the output file system or reaching a quota.
However, there is no risk of an infinite loop if grep is generating
no output, i.e., with --silent, --quiet, -q.
Similarly, with any of these:
--max-count=N (-m) (for N >= 2)
--files-with-matches (-l)
--files-without-match (-L)
there is no risk of trouble.
For --max-count=1, grep stops after printing the first match,
so there is no risk of malfunction. But even --max-count=2, with
input==output, while there is no risk of infloop, there is a race
condition that could result in "alternate" output. */
if (!out_quiet && list_files == 0 && 1 < max_count
&& S_ISREG (out_stat.st_mode) && out_stat.st_ino
&& SAME_INODE (stats->stat, out_stat))
{
if (! suppress_errors)
error (0, 0, _("input file %s is also the output"), quote (filename));
errseen = 1;
if (file)
close (desc);
return 1;
}
if (desc < 0)
{
desc = open (file, O_RDONLY);
if (desc < 0)
{
suppressible_error (file, errno);
return 1;
}
}
#if defined SET_BINARY
/* Set input to binary mode. Pipes are simulated with files
on DOS, so this includes the case of "foo | grep bar". */
if (!isatty (desc))
SET_BINARY (desc);
#endif
count = grep (desc, file, stats);
if (count < 0)
status = count + 2;
else
{
if (count_matches)
{
if (out_file)
{
print_filename ();
if (filename_mask)
print_sep (SEP_CHAR_SELECTED);
else
fputc (0, stdout);
}
printf ("%d\n", count);
}
else
fputc (0, stdout);
}
printf ("%d\n", count);
}
status = !count;
if (! file)
{
off_t required_offset = outleft ? bufoffset : after_last_match;
if (required_offset != bufoffset
&& lseek (desc, required_offset, SEEK_SET) < 0
&& S_ISREG (stats->stat.st_mode))
suppressible_error (filename, errno);
}
else
while (close (desc) != 0)
if (errno != EINTR)
{
suppressible_error (file, errno);
break;
}
}
| 3,604 |
93,251 | 0 | vldb_reply_print(netdissect_options *ndo,
register const u_char *bp, int length, int32_t opcode)
{
const struct rx_header *rxh;
unsigned long i;
if (length < (int)sizeof(struct rx_header))
return;
rxh = (const struct rx_header *) bp;
/*
* Print out the afs call we're invoking. The table used here was
* gleaned from vlserver/vldbint.xg. Check to see if it's a
* Ubik call, however.
*/
ND_PRINT((ndo, " vldb"));
if (is_ubik(opcode)) {
ubik_reply_print(ndo, bp, length, opcode);
return;
}
ND_PRINT((ndo, " reply %s", tok2str(vldb_req, "op#%d", opcode)));
bp += sizeof(struct rx_header);
/*
* If it was a data packet, interpret the response
*/
if (rxh->type == RX_PACKET_TYPE_DATA)
switch (opcode) {
case 510: /* List entry */
ND_PRINT((ndo, " count"));
INTOUT();
ND_PRINT((ndo, " nextindex"));
INTOUT();
/*FALLTHROUGH*/
case 503: /* Get entry by id */
case 504: /* Get entry by name */
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
ND_TCHECK2(bp[0], sizeof(int32_t));
bp += sizeof(int32_t);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
for (i = 0; i < 8; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
ND_PRINT((ndo, " %s",
intoa(((const struct in_addr *) bp)->s_addr)));
bp += sizeof(int32_t);
}
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 8; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
ND_PRINT((ndo, " %lu", j));
bp += sizeof(int32_t);
}
ND_TCHECK2(bp[0], 8 * sizeof(int32_t));
bp += 8 * sizeof(int32_t);
ND_PRINT((ndo, " rwvol"));
UINTOUT();
ND_PRINT((ndo, " rovol"));
UINTOUT();
ND_PRINT((ndo, " backup"));
UINTOUT();
}
break;
case 505: /* Get new volume ID */
ND_PRINT((ndo, " newvol"));
UINTOUT();
break;
case 521: /* List entry */
case 529: /* List entry U */
ND_PRINT((ndo, " count"));
INTOUT();
ND_PRINT((ndo, " nextindex"));
INTOUT();
/*FALLTHROUGH*/
case 518: /* Get entry by ID N */
case 519: /* Get entry by name N */
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
for (i = 0; i < 13; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
ND_PRINT((ndo, " %s",
intoa(((const struct in_addr *) bp)->s_addr)));
bp += sizeof(int32_t);
}
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
ND_PRINT((ndo, " %lu", j));
bp += sizeof(int32_t);
}
ND_TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
ND_PRINT((ndo, " rwvol"));
UINTOUT();
ND_PRINT((ndo, " rovol"));
UINTOUT();
ND_PRINT((ndo, " backup"));
UINTOUT();
}
break;
case 526: /* Get entry by ID U */
case 527: /* Get entry by name U */
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
ND_PRINT((ndo, " numservers"));
ND_TCHECK2(bp[0], sizeof(int32_t));
nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
ND_PRINT((ndo, " %lu", nservers));
ND_PRINT((ndo, " servers"));
for (i = 0; i < 13; i++) {
if (i < nservers) {
ND_PRINT((ndo, " afsuuid"));
AFSUUIDOUT();
} else {
ND_TCHECK2(bp[0], 44);
bp += 44;
}
}
ND_TCHECK2(bp[0], 4 * 13);
bp += 4 * 13;
ND_PRINT((ndo, " partitions"));
for (i = 0; i < 13; i++) {
ND_TCHECK2(bp[0], sizeof(int32_t));
j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
ND_PRINT((ndo, " %c", 'a' + (int)j));
else if (i < nservers)
ND_PRINT((ndo, " %lu", j));
bp += sizeof(int32_t);
}
ND_TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
ND_PRINT((ndo, " rwvol"));
UINTOUT();
ND_PRINT((ndo, " rovol"));
UINTOUT();
ND_PRINT((ndo, " backup"));
UINTOUT();
}
default:
;
}
else {
/*
* Otherwise, just print out the return code
*/
ND_PRINT((ndo, " errcode"));
INTOUT();
}
return;
trunc:
ND_PRINT((ndo, " [|vldb]"));
}
| 3,605 |
132,656 | 0 | std::string BlinkTestRunner::PathToLocalResource(const std::string& resource) {
#if defined(OS_WIN)
if (resource.find("/tmp/") == 0) {
GURL base_url = net::FilePathToFileURL(test_config_.temp_path);
return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec();
}
#endif
std::string result = resource;
while (base::StringToLowerASCII(result).find("file:////") == 0) {
result = result.substr(0, strlen("file:///")) +
result.substr(strlen("file:////"));
}
return RewriteLayoutTestsURL(result).spec();
}
| 3,606 |
176,698 | 0 | xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data,
const char *filename) {
int ret = 0;
xmlParserCtxtPtr ctxt;
ctxt = xmlCreateFileParserCtxt(filename);
if (ctxt == NULL) return -1;
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
xmlFree(ctxt->sax);
ctxt->sax = sax;
xmlDetectSAX2(ctxt);
if (user_data != NULL)
ctxt->userData = user_data;
xmlParseDocument(ctxt);
if (ctxt->wellFormed)
ret = 0;
else {
if (ctxt->errNo != 0)
ret = ctxt->errNo;
else
ret = -1;
}
if (sax != NULL)
ctxt->sax = NULL;
if (ctxt->myDoc != NULL) {
xmlFreeDoc(ctxt->myDoc);
ctxt->myDoc = NULL;
}
xmlFreeParserCtxt(ctxt);
return ret;
}
| 3,607 |
183,199 | 1 | bootp_print(netdissect_options *ndo,
register const u_char *cp, u_int length)
{
register const struct bootp *bp;
static const u_char vm_cmu[4] = VM_CMU;
static const u_char vm_rfc1048[4] = VM_RFC1048;
bp = (const struct bootp *)cp;
ND_TCHECK(bp->bp_op);
ND_PRINT((ndo, "BOOTP/DHCP, %s",
tok2str(bootp_op_values, "unknown (0x%02x)", bp->bp_op)));
ND_TCHECK(bp->bp_hlen);
if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
ND_TCHECK2(bp->bp_chaddr[0], 6);
ND_PRINT((ndo, " from %s", etheraddr_string(ndo, bp->bp_chaddr)));
}
ND_PRINT((ndo, ", length %u", length));
if (!ndo->ndo_vflag)
return;
ND_TCHECK(bp->bp_secs);
/* The usual hardware address type is 1 (10Mb Ethernet) */
if (bp->bp_htype != 1)
ND_PRINT((ndo, ", htype %d", bp->bp_htype));
/* The usual length for 10Mb Ethernet address is 6 bytes */
if (bp->bp_htype != 1 || bp->bp_hlen != 6)
ND_PRINT((ndo, ", hlen %d", bp->bp_hlen));
/* Only print interesting fields */
if (bp->bp_hops)
ND_PRINT((ndo, ", hops %d", bp->bp_hops));
if (EXTRACT_32BITS(&bp->bp_xid))
ND_PRINT((ndo, ", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid)));
if (EXTRACT_16BITS(&bp->bp_secs))
ND_PRINT((ndo, ", secs %d", EXTRACT_16BITS(&bp->bp_secs)));
ND_PRINT((ndo, ", Flags [%s]",
bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags))));
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags)));
/* Client's ip address */
ND_TCHECK(bp->bp_ciaddr);
if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr))
ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr)));
/* 'your' ip address (bootp client) */
ND_TCHECK(bp->bp_yiaddr);
if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr))
ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr)));
/* Server's ip address */
ND_TCHECK(bp->bp_siaddr);
if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr))
ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr)));
/* Gateway's ip address */
ND_TCHECK(bp->bp_giaddr);
if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr))
ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr)));
/* Client's Ethernet address */
if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
ND_TCHECK2(bp->bp_chaddr[0], 6);
ND_PRINT((ndo, "\n\t Client-Ethernet-Address %s", etheraddr_string(ndo, bp->bp_chaddr)));
}
ND_TCHECK2(bp->bp_sname[0], 1); /* check first char only */
if (*bp->bp_sname) {
ND_PRINT((ndo, "\n\t sname \""));
if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname,
ndo->ndo_snapend)) {
ND_PRINT((ndo, "\""));
ND_PRINT((ndo, "%s", tstr + 1));
return;
}
ND_PRINT((ndo, "\""));
}
ND_TCHECK2(bp->bp_file[0], 1); /* check first char only */
if (*bp->bp_file) {
ND_PRINT((ndo, "\n\t file \""));
if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file,
ndo->ndo_snapend)) {
ND_PRINT((ndo, "\""));
ND_PRINT((ndo, "%s", tstr + 1));
return;
}
ND_PRINT((ndo, "\""));
}
/* Decode the vendor buffer */
ND_TCHECK(bp->bp_vend[0]);
if (memcmp((const char *)bp->bp_vend, vm_rfc1048,
sizeof(uint32_t)) == 0)
rfc1048_print(ndo, bp->bp_vend);
else if (memcmp((const char *)bp->bp_vend, vm_cmu,
sizeof(uint32_t)) == 0)
cmu_print(ndo, bp->bp_vend);
else {
uint32_t ul;
ul = EXTRACT_32BITS(&bp->bp_vend);
if (ul != 0)
ND_PRINT((ndo, "\n\t Vendor-#0x%x", ul));
}
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
| 3,608 |
19,167 | 0 | static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{
struct inet_sock *inet = inet_sk(sk);
struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr;
int ret = -EINVAL;
int chk_addr_ret;
ret = -EADDRINUSE;
read_lock_bh(&l2tp_ip_lock);
if (__l2tp_ip_bind_lookup(&init_net, addr->l2tp_addr.s_addr, sk->sk_bound_dev_if, addr->l2tp_conn_id))
goto out_in_use;
read_unlock_bh(&l2tp_ip_lock);
lock_sock(sk);
if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip))
goto out;
chk_addr_ret = inet_addr_type(&init_net, addr->l2tp_addr.s_addr);
ret = -EADDRNOTAVAIL;
if (addr->l2tp_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
goto out;
inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
inet->inet_saddr = 0; /* Use device */
sk_dst_reset(sk);
l2tp_ip_sk(sk)->conn_id = addr->l2tp_conn_id;
write_lock_bh(&l2tp_ip_lock);
sk_add_bind_node(sk, &l2tp_ip_bind_table);
sk_del_node_init(sk);
write_unlock_bh(&l2tp_ip_lock);
ret = 0;
out:
release_sock(sk);
return ret;
out_in_use:
read_unlock_bh(&l2tp_ip_lock);
return ret;
}
| 3,609 |
145,968 | 0 | void DestroyTabletModeWindowManager() {
Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(
false);
EXPECT_FALSE(tablet_mode_window_manager());
}
| 3,610 |
116,333 | 0 | bool QQuickWebViewExperimental::useDefaultContentItemSize() const
{
Q_D(const QQuickWebView);
return d->m_useDefaultContentItemSize;
}
| 3,611 |
56,265 | 0 | SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC)
{
sapi_header_line ctr = {0};
int r;
ctr.line = header_line;
ctr.line_len = header_line_len;
r = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD,
&ctr TSRMLS_CC);
if (!duplicate)
efree(header_line);
return r;
}
| 3,612 |
116,804 | 0 | void WebRTCAudioDeviceTest::SetAudioUtilCallback(AudioUtilInterface* callback) {
audio_hardware::ResetCache();
audio_util_callback_ = callback;
}
| 3,613 |
125,686 | 0 | void RenderViewHostImpl::OnShowView(int route_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
if (!is_swapped_out_) {
delegate_->ShowCreatedWindow(
route_id, disposition, initial_pos, user_gesture);
}
Send(new ViewMsg_Move_ACK(route_id));
}
| 3,614 |
759 | 0 | poppler_form_field_mapping_new (void)
{
return (PopplerFormFieldMapping *) g_new0 (PopplerFormFieldMapping, 1);
}
| 3,615 |
155,107 | 0 | void OmniboxViewViews::EnterKeywordModeForDefaultSearchProvider() {
model()->EnterKeywordModeForDefaultSearchProvider(
OmniboxEventProto::KEYBOARD_SHORTCUT);
}
| 3,616 |
83,173 | 0 | envadjust(mrb_state *mrb, mrb_value *oldbase, mrb_value *newbase, size_t size)
{
mrb_callinfo *ci = mrb->c->cibase;
if (newbase == oldbase) return;
while (ci <= mrb->c->ci) {
struct REnv *e = ci->env;
mrb_value *st;
if (e && MRB_ENV_STACK_SHARED_P(e) &&
(st = e->stack) && oldbase <= st && st < oldbase+size) {
ptrdiff_t off = e->stack - oldbase;
e->stack = newbase + off;
}
if (ci->proc && MRB_PROC_ENV_P(ci->proc) && ci->env != MRB_PROC_ENV(ci->proc)) {
e = MRB_PROC_ENV(ci->proc);
if (e && MRB_ENV_STACK_SHARED_P(e) &&
(st = e->stack) && oldbase <= st && st < oldbase+size) {
ptrdiff_t off = e->stack - oldbase;
e->stack = newbase + off;
}
}
ci->stackent = newbase + (ci->stackent - oldbase);
ci++;
}
}
| 3,617 |
70,255 | 0 | Luv24toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
{
uint32* luv = (uint32*) sp->tbuf;
uint8* rgb = (uint8*) op;
while (n-- > 0) {
float xyz[3];
LogLuv24toXYZ(*luv++, xyz);
XYZtoRGB24(xyz, rgb);
rgb += 3;
}
}
| 3,618 |
67,797 | 0 | static void sig_print_starting(TEXT_DEST_REC *dest)
{
NETJOIN_SERVER_REC *rec;
if (printing_joins)
return;
if (!IS_IRC_SERVER(dest->server))
return;
if (!(dest->level & MSGLEVEL_PUBLIC))
return;
if (!server_ischannel(dest->server, dest->target))
return;
rec = netjoin_find_server(IRC_SERVER(dest->server));
if (rec != NULL && rec->netjoins != NULL)
print_netjoins(rec, dest->target);
}
| 3,619 |
132,400 | 0 | const GritResourceMap* GetKeyboardExtensionResources(size_t* size) {
static const GritResourceMap kKeyboardResources[] = {
{"keyboard/locales/en.js", IDR_KEYBOARD_LOCALES_EN},
{"keyboard/config/m-emoji.js", IDR_KEYBOARD_CONFIG_EMOJI},
{"keyboard/config/m-hwt.js", IDR_KEYBOARD_CONFIG_HWT},
{"keyboard/config/us.js", IDR_KEYBOARD_CONFIG_US},
{"keyboard/emoji.css", IDR_KEYBOARD_CSS_EMOJI},
{"keyboard/images/backspace.png", IDR_KEYBOARD_IMAGES_BACKSPACE},
{"keyboard/images/car.png", IDR_KEYBOARD_IMAGES_CAR},
{"keyboard/images/check.png", IDR_KEYBOARD_IMAGES_CHECK},
{"keyboard/images/compact.png", IDR_KEYBOARD_IMAGES_COMPACT},
{"keyboard/images/down.png", IDR_KEYBOARD_IMAGES_DOWN},
{"keyboard/images/emoji.png", IDR_KEYBOARD_IMAGES_EMOJI},
{"keyboard/images/emoji_cat_items.png", IDR_KEYBOARD_IMAGES_CAT},
{"keyboard/images/emoticon.png", IDR_KEYBOARD_IMAGES_EMOTICON},
{"keyboard/images/enter.png", IDR_KEYBOARD_IMAGES_RETURN},
{"keyboard/images/error.png", IDR_KEYBOARD_IMAGES_ERROR},
{"keyboard/images/favorit.png", IDR_KEYBOARD_IMAGES_FAVORITE},
{"keyboard/images/flower.png", IDR_KEYBOARD_IMAGES_FLOWER},
{"keyboard/images/globe.png", IDR_KEYBOARD_IMAGES_GLOBE},
{"keyboard/images/hide.png", IDR_KEYBOARD_IMAGES_HIDE_KEYBOARD},
{"keyboard/images/keyboard.svg", IDR_KEYBOARD_IMAGES_KEYBOARD},
{"keyboard/images/left.png", IDR_KEYBOARD_IMAGES_LEFT},
{"keyboard/images/penci.png", IDR_KEYBOARD_IMAGES_PENCIL},
{"keyboard/images/recent.png", IDR_KEYBOARD_IMAGES_RECENT},
{"keyboard/images/regular_size.png", IDR_KEYBOARD_IMAGES_FULLSIZE},
{"keyboard/images/menu.png", IDR_KEYBOARD_IMAGES_MENU},
{"keyboard/images/pencil.png", IDR_KEYBOARD_IMAGES_PENCIL},
{"keyboard/images/right.png", IDR_KEYBOARD_IMAGES_RIGHT},
{"keyboard/images/search.png", IDR_KEYBOARD_IMAGES_SEARCH},
{"keyboard/images/setting.png", IDR_KEYBOARD_IMAGES_SETTINGS},
{"keyboard/images/shift.png", IDR_KEYBOARD_IMAGES_SHIFT},
{"keyboard/images/space.png", IDR_KEYBOARD_IMAGES_SPACE},
{"keyboard/images/tab.png", IDR_KEYBOARD_IMAGES_TAB},
{"keyboard/images/triangle.png", IDR_KEYBOARD_IMAGES_TRIANGLE},
{"keyboard/images/up.png", IDR_KEYBOARD_IMAGES_UP},
{"keyboard/index.html", IDR_KEYBOARD_INDEX},
{"keyboard/inputview_adapter.js", IDR_KEYBOARD_INPUTVIEW_ADAPTER},
{"keyboard/inputview.css", IDR_KEYBOARD_INPUTVIEW_CSS},
{"keyboard/inputview.js", IDR_KEYBOARD_INPUTVIEW_JS},
{"keyboard/inputview_layouts/101kbd.js", IDR_KEYBOARD_LAYOUTS_101},
{"keyboard/inputview_layouts/compactkbd-qwerty.js",
IDR_KEYBOARD_LAYOUTS_COMPACT_QWERTY},
{"keyboard/inputview_layouts/compactkbd-numberpad.js",
IDR_KEYBOARD_LAYOUTS_COMPACT_NUMBERPAD},
{"keyboard/inputview_layouts/emoji.js", IDR_KEYBOARD_LAYOUTS_EMOJI},
{"keyboard/inputview_layouts/handwriting.js", IDR_KEYBOARD_LAYOUTS_HWT},
{"keyboard/inputview_layouts/m-101kbd.js",
IDR_KEYBOARD_LAYOUTS_MATERIAL_101},
{"keyboard/inputview_layouts/m-compactkbd-qwerty.js",
IDR_KEYBOARD_LAYOUTS_MATERIAL_COMPACT_QWERTY},
{"keyboard/inputview_layouts/m-compactkbd-numberpad.js",
IDR_KEYBOARD_LAYOUTS_MATERIAL_COMPACT_NUMBERPAD},
{"keyboard/inputview_layouts/m-emoji.js",
IDR_KEYBOARD_LAYOUTS_MATERIAL_EMOJI},
{"keyboard/inputview_layouts/m-handwriting.js",
IDR_KEYBOARD_LAYOUTS_MATERIAL_HWT},
{"keyboard/manifest.json", IDR_KEYBOARD_MANIFEST},
{"keyboard/sounds/keypress-delete.wav",
IDR_KEYBOARD_SOUNDS_KEYPRESS_DELETE},
{"keyboard/sounds/keypress-return.wav",
IDR_KEYBOARD_SOUNDS_KEYPRESS_RETURN},
{"keyboard/sounds/keypress-spacebar.wav",
IDR_KEYBOARD_SOUNDS_KEYPRESS_SPACEBAR},
{"keyboard/sounds/keypress-standard.wav",
IDR_KEYBOARD_SOUNDS_KEYPRESS_STANDARD},
};
static const size_t kKeyboardResourcesSize = arraysize(kKeyboardResources);
*size = kKeyboardResourcesSize;
return kKeyboardResources;
}
| 3,620 |
76,890 | 0 | encode_SET_IPV4_addr(const struct ofpact_ipv4 *ipv4,
enum ofp_version ofp_version,
enum ofp_raw_action_type raw, enum mf_field_id field,
struct ofpbuf *out)
{
ovs_be32 addr = ipv4->ipv4;
if (ofp_version < OFP12_VERSION) {
ofpact_put_raw(out, ofp_version, raw, ntohl(addr));
} else {
put_set_field(out, ofp_version, field, ntohl(addr));
}
}
| 3,621 |
30,739 | 0 | static int rfcomm_sock_getsockopt_old(struct socket *sock, int optname, char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
struct rfcomm_conninfo cinfo;
struct l2cap_conn *conn = l2cap_pi(sk)->chan->conn;
int len, err = 0;
u32 opt;
BT_DBG("sk %p", sk);
if (get_user(len, optlen))
return -EFAULT;
lock_sock(sk);
switch (optname) {
case RFCOMM_LM:
switch (rfcomm_pi(sk)->sec_level) {
case BT_SECURITY_LOW:
opt = RFCOMM_LM_AUTH;
break;
case BT_SECURITY_MEDIUM:
opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT;
break;
case BT_SECURITY_HIGH:
opt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT |
RFCOMM_LM_SECURE;
break;
default:
opt = 0;
break;
}
if (rfcomm_pi(sk)->role_switch)
opt |= RFCOMM_LM_MASTER;
if (put_user(opt, (u32 __user *) optval))
err = -EFAULT;
break;
case RFCOMM_CONNINFO:
if (sk->sk_state != BT_CONNECTED &&
!rfcomm_pi(sk)->dlc->defer_setup) {
err = -ENOTCONN;
break;
}
memset(&cinfo, 0, sizeof(cinfo));
cinfo.hci_handle = conn->hcon->handle;
memcpy(cinfo.dev_class, conn->hcon->dev_class, 3);
len = min_t(unsigned int, len, sizeof(cinfo));
if (copy_to_user(optval, (char *) &cinfo, len))
err = -EFAULT;
break;
default:
err = -ENOPROTOOPT;
break;
}
release_sock(sk);
return err;
}
| 3,622 |
76,593 | 0 | int ws_svr_broadcast_text(ws_svr *svr, char *message)
{
return broadcast_message(svr, 0x1, message, strlen(message));
}
| 3,623 |
115,599 | 0 | void GraphicsContext::drawLineForText(const FloatPoint& pt,
float width,
bool printing)
{
if (paintingDisabled())
return;
if (width <= 0)
return;
int thickness = SkMax32(static_cast<int>(strokeThickness()), 1);
SkRect r;
r.fLeft = WebCoreFloatToSkScalar(pt.x());
r.fTop = WebCoreFloatToSkScalar(pt.y());
r.fRight = r.fLeft + WebCoreFloatToSkScalar(width);
r.fBottom = r.fTop + SkIntToScalar(thickness);
SkPaint paint;
platformContext()->setupPaintForFilling(&paint);
paint.setColor(platformContext()->effectiveStrokeColor());
platformContext()->canvas()->drawRect(r, paint);
}
| 3,624 |
123,174 | 0 | ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const {
aura::RootWindow* root_window = window_->GetRootWindow();
if (!root_window)
return NULL;
return root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
}
| 3,625 |
11,473 | 0 | fbStore_a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)
{
int i;
for (i = 0; i < width; ++i) {
Store4(bits, i + x, READ(values + i)>>28);
}
}
| 3,626 |
164,995 | 0 | SkFilterQuality HTMLCanvasElement::FilterQuality() const {
if (!isConnected())
return kLow_SkFilterQuality;
const ComputedStyle* style = GetComputedStyle();
if (!style) {
GetDocument().UpdateStyleAndLayoutTreeForNode(this);
HTMLCanvasElement* non_const_this = const_cast<HTMLCanvasElement*>(this);
style = non_const_this->EnsureComputedStyle();
}
return (style && style->ImageRendering() == EImageRendering::kPixelated)
? kNone_SkFilterQuality
: kLow_SkFilterQuality;
}
| 3,627 |
81,822 | 0 | void xrevrangeCommand(client *c) {
xrangeGenericCommand(c,1);
}
| 3,628 |
44,072 | 0 | static gboolean patch_legacy_mode(void)
{
static gboolean init = TRUE;
static gboolean legacy = FALSE;
if(init) {
init = FALSE;
legacy = daemon_option_enabled("cib", "legacy");
if(legacy) {
crm_notice("Enabled legacy mode");
}
}
return legacy;
}
| 3,629 |
15,788 | 0 | static void sysbus_ahci_register_types(void)
{
type_register_static(&sysbus_ahci_info);
}
| 3,630 |
25,379 | 0 | static void mipspmu_start(struct perf_event *event, int flags)
{
struct hw_perf_event *hwc = &event->hw;
if (!mipspmu)
return;
if (flags & PERF_EF_RELOAD)
WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
hwc->state = 0;
/* Set the period for the event. */
mipspmu_event_set_period(event, hwc, hwc->idx);
/* Enable the event. */
mipspmu->enable_event(hwc, hwc->idx);
}
| 3,631 |
60,376 | 0 | send_data_or_handle(char type, u_int32_t id, const u_char *data, int dlen)
{
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((r = sshbuf_put_u8(msg, type)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_string(msg, data, dlen)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
send_msg(msg);
sshbuf_free(msg);
}
| 3,632 |
127,535 | 0 | void LayerWebKitThread::setIsMask(bool isMask)
{
m_isMask = isMask;
if (isMask && m_tiler)
m_tiler->setNeedsBacking(true);
}
| 3,633 |
105,740 | 0 | const char* PropTypeToString(int prop_type) {
switch (static_cast<IBusPropType>(prop_type)) {
case PROP_TYPE_NORMAL:
return "NORMAL";
case PROP_TYPE_TOGGLE:
return "TOGGLE";
case PROP_TYPE_RADIO:
return "RADIO";
case PROP_TYPE_MENU:
return "MENU";
case PROP_TYPE_SEPARATOR:
return "SEPARATOR";
}
return "UNKNOWN";
}
| 3,634 |
184,754 | 1 | void InputMethodBase::OnInputMethodChanged() const {
TextInputClient* client = GetTextInputClient();
if (client && client->GetTextInputType() != TEXT_INPUT_TYPE_NONE)
client->OnInputMethodChanged();
}
| 3,635 |
121,854 | 0 | void IOThread::EnableSpdy(const std::string& mode) {
static const char kOff[] = "off";
static const char kSSL[] = "ssl";
static const char kDisableSSL[] = "no-ssl";
static const char kDisablePing[] = "no-ping";
static const char kExclude[] = "exclude"; // Hosts to exclude
static const char kDisableCompression[] = "no-compress";
static const char kDisableAltProtocols[] = "no-alt-protocols";
static const char kForceAltProtocols[] = "force-alt-protocols";
static const char kSingleDomain[] = "single-domain";
static const char kInitialMaxConcurrentStreams[] = "init-max-streams";
std::vector<std::string> spdy_options;
base::SplitString(mode, ',', &spdy_options);
for (std::vector<std::string>::iterator it = spdy_options.begin();
it != spdy_options.end(); ++it) {
const std::string& element = *it;
std::vector<std::string> name_value;
base::SplitString(element, '=', &name_value);
const std::string& option =
name_value.size() > 0 ? name_value[0] : std::string();
const std::string value =
name_value.size() > 1 ? name_value[1] : std::string();
if (option == kOff) {
net::HttpStreamFactory::set_spdy_enabled(false);
} else if (option == kDisableSSL) {
globals_->spdy_default_protocol.set(net::kProtoSPDY3);
net::HttpStreamFactory::set_force_spdy_over_ssl(false);
net::HttpStreamFactory::set_force_spdy_always(true);
} else if (option == kSSL) {
globals_->spdy_default_protocol.set(net::kProtoSPDY3);
net::HttpStreamFactory::set_force_spdy_over_ssl(true);
net::HttpStreamFactory::set_force_spdy_always(true);
} else if (option == kDisablePing) {
globals_->enable_spdy_ping_based_connection_checking.set(false);
} else if (option == kExclude) {
net::HttpStreamFactory::add_forced_spdy_exclusion(value);
} else if (option == kDisableCompression) {
globals_->enable_spdy_compression.set(false);
} else if (option == kDisableAltProtocols) {
net::HttpStreamFactory::set_use_alternate_protocols(false);
} else if (option == kForceAltProtocols) {
net::PortAlternateProtocolPair pair;
pair.port = 443;
pair.protocol = net::NPN_SPDY_3;
net::HttpServerPropertiesImpl::ForceAlternateProtocol(pair);
} else if (option == kSingleDomain) {
DVLOG(1) << "FORCING SINGLE DOMAIN";
globals_->force_spdy_single_domain.set(true);
} else if (option == kInitialMaxConcurrentStreams) {
int streams;
if (base::StringToInt(value, &streams))
globals_->initial_max_spdy_concurrent_streams.set(streams);
} else if (option.empty() && it == spdy_options.begin()) {
continue;
} else {
LOG(DFATAL) << "Unrecognized spdy option: " << option;
}
}
}
| 3,636 |
24,630 | 0 | static void fuse_request_send_nowait(struct fuse_conn *fc, struct fuse_req *req)
{
spin_lock(&fc->lock);
if (fc->connected) {
fuse_request_send_nowait_locked(fc, req);
spin_unlock(&fc->lock);
} else {
req->out.h.error = -ENOTCONN;
request_end(fc, req);
}
}
| 3,637 |
163,114 | 0 | void BlobStorageContext::RunOnConstructionComplete(
const std::string& uuid,
const BlobStatusCallback& done) {
BlobEntry* entry = registry_.GetEntry(uuid);
DCHECK(entry);
if (BlobStatusIsPending(entry->status())) {
entry->building_state_->build_completion_callbacks.push_back(done);
return;
}
done.Run(entry->status());
}
| 3,638 |
39,954 | 0 | vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy)
{
struct vhost_net_ubuf_ref *ubufs;
/* No zero copy backend? Nothing to count. */
if (!zcopy)
return NULL;
ubufs = kmalloc(sizeof(*ubufs), GFP_KERNEL);
if (!ubufs)
return ERR_PTR(-ENOMEM);
atomic_set(&ubufs->refcount, 1);
init_waitqueue_head(&ubufs->wait);
ubufs->vq = vq;
return ubufs;
}
| 3,639 |
173,414 | 0 | void omx_vdec::append_user_extradata(OMX_OTHER_EXTRADATATYPE *extra,
OMX_OTHER_EXTRADATATYPE *p_user)
{
int userdata_size = 0;
struct msm_vidc_stream_userdata_payload *userdata_payload = NULL;
userdata_payload =
(struct msm_vidc_stream_userdata_payload *)(void *)p_user->data;
userdata_size = p_user->nDataSize;
extra->nSize = OMX_USERDATA_EXTRADATA_SIZE + userdata_size;
extra->nVersion.nVersion = OMX_SPEC_VERSION;
extra->nPortIndex = OMX_CORE_OUTPUT_PORT_INDEX;
extra->eType = (OMX_EXTRADATATYPE)OMX_ExtraDataMP2UserData;
extra->nDataSize = userdata_size;
if (extra->data && p_user->data && extra->nDataSize)
memcpy(extra->data, p_user->data, extra->nDataSize);
print_debug_extradata(extra);
}
| 3,640 |
6,468 | 0 | int EC_GROUP_get_basis_type(const EC_GROUP *group)
{
int i = 0;
if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
NID_X9_62_characteristic_two_field)
/* everything else is currently not supported */
return 0;
while (group->poly[i] != 0)
i++;
if (i == 4)
return NID_X9_62_ppBasis;
else if (i == 2)
return NID_X9_62_tpBasis;
else
/* everything else is currently not supported */
return 0;
}
| 3,641 |
145,661 | 0 | void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
extension_options_internal::PreferredSizeChangedOptions options;
options.width = PhysicalPixelsToLogicalPixels(pref_size.width());
options.height = PhysicalPixelsToLogicalPixels(pref_size.height());
DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
extension_options_internal::OnPreferredSizeChanged::kEventName,
options.ToValue())));
}
| 3,642 |
117,661 | 0 | void RegisterComponentsForUpdate(const CommandLine& command_line) {
ComponentUpdateService* cus = g_browser_process->component_updater();
if (!cus)
return;
RegisterRecoveryComponent(cus, g_browser_process->local_state());
RegisterPepperFlashComponent(cus);
RegisterNPAPIFlashComponent(cus);
RegisterSwiftShaderComponent(cus);
if (command_line.HasSwitch(switches::kEnableCRLSets))
g_browser_process->crl_set_fetcher()->StartInitialLoad(cus);
if (command_line.HasSwitch(switches::kEnablePnacl)) {
RegisterPnaclComponent(cus);
}
cus->Start();
}
| 3,643 |
87,184 | 0 | BOOL IsVolumeClassFilterRegistered ()
{
UNICODE_STRING name;
NTSTATUS status;
BOOL registered = FALSE;
PKEY_VALUE_PARTIAL_INFORMATION data;
RtlInitUnicodeString (&name, L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{71A27CDD-812A-11D0-BEC7-08002BE2092F}");
status = TCReadRegistryKey (&name, L"UpperFilters", &data);
if (NT_SUCCESS (status))
{
if (data->Type == REG_MULTI_SZ && data->DataLength >= 9 * sizeof (wchar_t))
{
ULONG i;
for (i = 0; i <= data->DataLength - 9 * sizeof (wchar_t); ++i)
{
if (memcmp (data->Data + i, L"veracrypt", 9 * sizeof (wchar_t)) == 0)
{
Dump ("Volume class filter active\n");
registered = TRUE;
break;
}
}
}
TCfree (data);
}
return registered;
}
| 3,644 |
53,060 | 0 | static int bpf_prog_charge_memlock(struct bpf_prog *prog)
{
struct user_struct *user = get_current_user();
unsigned long memlock_limit;
memlock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
atomic_long_add(prog->pages, &user->locked_vm);
if (atomic_long_read(&user->locked_vm) > memlock_limit) {
atomic_long_sub(prog->pages, &user->locked_vm);
free_uid(user);
return -EPERM;
}
prog->aux->user = user;
return 0;
}
| 3,645 |
172,776 | 0 | static bool underQTMetaPath(const Vector<uint32_t> &path, int32_t depth) {
return path.size() >= 2
&& path[0] == FOURCC('m', 'o', 'o', 'v')
&& path[1] == FOURCC('m', 'e', 't', 'a')
&& (depth == 2
|| (depth == 3
&& (path[2] == FOURCC('h', 'd', 'l', 'r')
|| path[2] == FOURCC('i', 'l', 's', 't')
|| path[2] == FOURCC('k', 'e', 'y', 's'))));
}
| 3,646 |
9,916 | 0 | void Part::setupView()
{
m_view->setContextMenuPolicy(Qt::CustomContextMenu);
m_view->setModel(m_model);
connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &Part::updateActions);
connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &Part::selectionChanged);
connect(m_view, &QTreeView::activated, this, &Part::slotActivated);
connect(m_view, &QWidget::customContextMenuRequested, this, &Part::slotShowContextMenu);
}
| 3,647 |
165,197 | 0 | DragState& DragController::GetDragState() {
if (!drag_state_)
drag_state_ = new DragState;
return *drag_state_;
}
| 3,648 |
134,362 | 0 | const views::View* TabStrip::GetViewByID(int view_id) const {
if (tab_count() > 0) {
if (view_id == VIEW_ID_TAB_LAST) {
return tab_at(tab_count() - 1);
} else if ((view_id >= VIEW_ID_TAB_0) && (view_id < VIEW_ID_TAB_LAST)) {
int index = view_id - VIEW_ID_TAB_0;
if (index >= 0 && index < tab_count()) {
return tab_at(index);
} else {
return NULL;
}
}
}
return View::GetViewByID(view_id);
}
| 3,649 |
124,301 | 0 | ExtensionSystemImpl::serial_connection_manager() {
return serial_connection_manager_.get();
}
| 3,650 |
135,247 | 0 | void Document::exitPointerLock()
{
if (!page())
return;
if (Element* target = page()->pointerLockController().element()) {
if (target->document() != this)
return;
}
page()->pointerLockController().requestPointerUnlock();
}
| 3,651 |
154,764 | 0 | error::Error GLES2DecoderPassthroughImpl::DoPostSubBufferCHROMIUM(
uint64_t swap_id,
GLint x,
GLint y,
GLint width,
GLint height,
GLbitfield flags) {
if (!surface_->SupportsPostSubBuffer()) {
InsertError(GL_INVALID_OPERATION,
"glPostSubBufferCHROMIUM is not supported for this surface.");
return error::kNoError;
}
client()->OnSwapBuffers(swap_id, flags);
return CheckSwapBuffersResult(
surface_->PostSubBuffer(x, y, width, height, base::DoNothing()),
"PostSubBuffer");
}
| 3,652 |
74,599 | 0 | enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path)
{
enum ovl_path_type type = ovl_path_type(dentry);
if (type == OVL_PATH_LOWER)
ovl_path_lower(dentry, path);
else
ovl_path_upper(dentry, path);
return type;
}
| 3,653 |
19,987 | 0 | static int nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
struct nfs4_exception exception = { };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(old_dir),
_nfs4_proc_rename(old_dir, old_name,
new_dir, new_name),
&exception);
} while (exception.retry);
return err;
}
| 3,654 |
59,526 | 0 | xmlParseVersionNum(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len = 0;
int size = 10;
xmlChar cur;
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
return(NULL);
}
cur = CUR;
if (!((cur >= '0') && (cur <= '9'))) {
xmlFree(buf);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur=CUR;
if (cur != '.') {
xmlFree(buf);
return(NULL);
}
buf[len++] = cur;
NEXT;
cur=CUR;
while ((cur >= '0') && (cur <= '9')) {
if (len + 1 >= size) {
xmlChar *tmp;
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
if (tmp == NULL) {
xmlFree(buf);
xmlErrMemory(ctxt, NULL);
return(NULL);
}
buf = tmp;
}
buf[len++] = cur;
NEXT;
cur=CUR;
}
buf[len] = 0;
return(buf);
}
| 3,655 |
77,150 | 0 | OVS_REQUIRES(ofproto_mutex)
{
uint32_t mid;
mid = ofpacts_get_meter(ofpacts, ofpacts_len);
if (mid && get_provider_meter_id(ofproto, mid) == UINT32_MAX) {
return OFPERR_OFPMMFC_INVALID_METER;
}
const struct ofpact_group *a;
OFPACT_FOR_EACH_TYPE_FLATTENED (a, GROUP, ofpacts, ofpacts_len) {
if (!ofproto_group_exists(ofproto, a->group_id)) {
return OFPERR_OFPBAC_BAD_OUT_GROUP;
}
}
return 0;
}
| 3,656 |
17,578 | 0 | ProcRenderCreateConicalGradient(ClientPtr client)
{
PicturePtr pPicture;
int len;
int error = 0;
xFixed *stops;
xRenderColor *colors;
REQUEST(xRenderCreateConicalGradientReq);
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
LEGAL_NEW_RESOURCE(stuff->pid, client);
len = (client->req_len << 2) - sizeof(xRenderCreateConicalGradientReq);
if (stuff->nStops > UINT32_MAX / (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
if (len != stuff->nStops * (sizeof(xFixed) + sizeof(xRenderColor)))
return BadLength;
stops = (xFixed *) (stuff + 1);
colors = (xRenderColor *) (stops + stuff->nStops);
pPicture =
CreateConicalGradientPicture(stuff->pid, &stuff->center, stuff->angle,
stuff->nStops, stops, colors, &error);
if (!pPicture)
return error;
/* security creation/labeling check */
error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType,
pPicture, RT_NONE, NULL, DixCreateAccess);
if (error != Success)
return error;
if (!AddResource(stuff->pid, PictureType, (void *) pPicture))
return BadAlloc;
return Success;
}
| 3,657 |
138,357 | 0 | ServiceManagerContext::~ServiceManagerContext() {
if (in_process_context_)
in_process_context_->ShutDown();
if (ServiceManagerConnection::GetForProcess())
ServiceManagerConnection::DestroyForProcess();
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&DestroyConnectorOnIOThread));
}
| 3,658 |
22,688 | 0 | static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
{
unsigned long mmcra = regs->dsisr;
if ((mmcra & MMCRA_SAMPLE_ENABLE) && !(ppmu->flags & PPMU_ALT_SIPR)) {
unsigned long slot = (mmcra & MMCRA_SLOT) >> MMCRA_SLOT_SHIFT;
if (slot > 1)
return 4 * (slot - 1);
}
return 0;
}
| 3,659 |
186,112 | 1 | void CallbackAndDie(bool succeeded) {
v8::Isolate* isolate = context_->isolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Value> args[] = {v8::Boolean::New(isolate, succeeded)};
context_->CallFunction(v8::Local<v8::Function>::New(isolate, callback_),
arraysize(args), args);
delete this;
}
| 3,660 |
10,523 | 0 | static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
{
/* We don't actually refresh here, but just return data queried in
* iscsi_open(): iscsi targets don't change their limits. */
IscsiLun *iscsilun = bs->opaque;
uint32_t max_xfer_len = iscsilun->use_16_for_rw ? 0xffffffff : 0xffff;
if (iscsilun->bl.max_xfer_len) {
max_xfer_len = MIN(max_xfer_len, iscsilun->bl.max_xfer_len);
}
bs->bl.max_transfer_length = sector_limits_lun2qemu(max_xfer_len, iscsilun);
if (iscsilun->lbp.lbpu) {
if (iscsilun->bl.max_unmap < 0xffffffff) {
bs->bl.max_discard =
sector_limits_lun2qemu(iscsilun->bl.max_unmap, iscsilun);
}
bs->bl.discard_alignment =
sector_limits_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
}
if (iscsilun->bl.max_ws_len < 0xffffffff) {
bs->bl.max_write_zeroes =
sector_limits_lun2qemu(iscsilun->bl.max_ws_len, iscsilun);
}
if (iscsilun->lbp.lbpws) {
bs->bl.write_zeroes_alignment =
sector_limits_lun2qemu(iscsilun->bl.opt_unmap_gran, iscsilun);
}
bs->bl.opt_transfer_length =
sector_limits_lun2qemu(iscsilun->bl.opt_xfer_len, iscsilun);
}
| 3,661 |
71,518 | 0 | ModuleExport size_t RegisterDPXImage(void)
{
MagickInfo
*entry;
static const char
*DPXNote =
{
"Digital Moving Picture Exchange Bitmap, Version 2.0.\n"
"See SMPTE 268M-2003 specification at http://www.smtpe.org\n"
};
entry=SetMagickInfo("DPX");
entry->decoder=(DecodeImageHandler *) ReadDPXImage;
entry->encoder=(EncodeImageHandler *) WriteDPXImage;
entry->magick=(IsImageFormatHandler *) IsDPX;
entry->adjoin=MagickFalse;
entry->description=ConstantString("SMPTE 268M-2003 (DPX 2.0)");
entry->note=ConstantString(DPXNote);
entry->module=ConstantString("DPX");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 3,662 |
74,050 | 0 | static Image *ReadPICTImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
geometry[MagickPathExtent],
header_ole[4];
Image
*image;
int
c,
code;
MagickBooleanType
jpeg,
status;
PICTRectangle
frame;
PICTPixmap
pixmap;
Quantum
index;
register Quantum
*q;
register ssize_t
i,
x;
size_t
extent,
length;
ssize_t
count,
flags,
j,
version,
y;
StringInfo
*profile;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read PICT header.
*/
pixmap.bits_per_pixel=0;
pixmap.component_count=0;
/*
Skip header : 512 for standard PICT and 4, ie "PICT" for OLE2.
*/
header_ole[0]=ReadBlobByte(image);
header_ole[1]=ReadBlobByte(image);
header_ole[2]=ReadBlobByte(image);
header_ole[3]=ReadBlobByte(image);
if (!((header_ole[0] == 0x50) && (header_ole[1] == 0x49) &&
(header_ole[2] == 0x43) && (header_ole[3] == 0x54 )))
for (i=0; i < 508; i++)
if (ReadBlobByte(image) == EOF)
break;
(void) ReadBlobMSBShort(image); /* skip picture size */
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
while ((c=ReadBlobByte(image)) == 0) ;
if (c != 0x11)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
version=ReadBlobByte(image);
if (version == 2)
{
c=ReadBlobByte(image);
if (c != 0xff)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
else
if (version != 1)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((frame.left < 0) || (frame.right < 0) || (frame.top < 0) ||
(frame.bottom < 0) || (frame.left >= frame.right) ||
(frame.top >= frame.bottom))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
Create black canvas.
*/
flags=0;
image->depth=8;
image->columns=1UL*(frame.right-frame.left);
image->rows=1UL*(frame.bottom-frame.top);
image->resolution.x=DefaultResolution;
image->resolution.y=DefaultResolution;
image->units=UndefinedResolution;
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
/*
Interpret PICT opcodes.
*/
jpeg=MagickFalse;
for (code=0; EOFBlob(image) == MagickFalse; )
{
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
if ((version == 1) || ((TellBlob(image) % 2) != 0))
code=ReadBlobByte(image);
if (version == 2)
code=(int) ReadBlobMSBShort(image);
if (code < 0)
break;
if (code > 0xa1)
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"%04X:",code);
}
else
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" %04X %s: %s",code,codes[code].name,codes[code].description);
switch (code)
{
case 0x01:
{
/*
Clipping rectangle.
*/
length=ReadBlobMSBShort(image);
if (length != 0x000a)
{
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (((frame.left & 0x8000) != 0) || ((frame.top & 0x8000) != 0))
break;
image->columns=1UL*(frame.right-frame.left);
image->rows=1UL*(frame.bottom-frame.top);
(void) SetImageBackgroundColor(image,exception);
break;
}
case 0x12:
case 0x13:
case 0x14:
{
ssize_t
pattern;
size_t
height,
width;
/*
Skip pattern definition.
*/
pattern=1L*ReadBlobMSBShort(image);
for (i=0; i < 8; i++)
if (ReadBlobByte(image) == EOF)
break;
if (pattern == 2)
{
for (i=0; i < 5; i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
if (pattern != 1)
ThrowReaderException(CorruptImageError,"UnknownPatternType");
length=ReadBlobMSBShort(image);
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
ReadPixmap(pixmap);
image->depth=1UL*pixmap.component_size;
image->resolution.x=1.0*pixmap.horizontal_resolution;
image->resolution.y=1.0*pixmap.vertical_resolution;
image->units=PixelsPerInchResolution;
(void) ReadBlobMSBLong(image);
flags=1L*ReadBlobMSBShort(image);
length=ReadBlobMSBShort(image);
for (i=0; i <= (ssize_t) length; i++)
(void) ReadBlobMSBLong(image);
width=1UL*(frame.bottom-frame.top);
height=1UL*(frame.right-frame.left);
if (pixmap.bits_per_pixel <= 8)
length&=0x7fff;
if (pixmap.bits_per_pixel == 16)
width<<=1;
if (length == 0)
length=width;
if (length < 8)
{
for (i=0; i < (ssize_t) (length*height); i++)
if (ReadBlobByte(image) == EOF)
break;
}
else
for (j=0; j < (int) height; j++)
if (length > 200)
{
for (j=0; j < (ssize_t) ReadBlobMSBShort(image); j++)
if (ReadBlobByte(image) == EOF)
break;
}
else
for (j=0; j < (ssize_t) ReadBlobByte(image); j++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
case 0x1b:
{
/*
Initialize image background color.
*/
image->background_color.red=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
image->background_color.green=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
image->background_color.blue=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
break;
}
case 0x70:
case 0x71:
case 0x72:
case 0x73:
case 0x74:
case 0x75:
case 0x76:
case 0x77:
{
/*
Skip polygon or region.
*/
length=ReadBlobMSBShort(image);
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
break;
}
case 0x90:
case 0x91:
case 0x98:
case 0x99:
case 0x9a:
case 0x9b:
{
Image
*tile_image;
PICTRectangle
source,
destination;
register unsigned char
*p;
size_t
j;
ssize_t
bytes_per_line;
unsigned char
*pixels;
/*
Pixmap clipped by a rectangle.
*/
bytes_per_line=0;
if ((code != 0x9a) && (code != 0x9b))
bytes_per_line=1L*ReadBlobMSBShort(image);
else
{
(void) ReadBlobMSBShort(image);
(void) ReadBlobMSBShort(image);
(void) ReadBlobMSBShort(image);
}
if (ReadRectangle(image,&frame) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
Initialize tile image.
*/
tile_image=CloneImage(image,1UL*(frame.right-frame.left),
1UL*(frame.bottom-frame.top),MagickTrue,exception);
if (tile_image == (Image *) NULL)
return((Image *) NULL);
if ((code == 0x9a) || (code == 0x9b) ||
((bytes_per_line & 0x8000) != 0))
{
ReadPixmap(pixmap);
tile_image->depth=1UL*pixmap.component_size;
tile_image->alpha_trait=pixmap.component_count == 4 ?
BlendPixelTrait : UndefinedPixelTrait;
tile_image->resolution.x=(double) pixmap.horizontal_resolution;
tile_image->resolution.y=(double) pixmap.vertical_resolution;
tile_image->units=PixelsPerInchResolution;
if (tile_image->alpha_trait != UndefinedPixelTrait)
image->alpha_trait=tile_image->alpha_trait;
}
if ((code != 0x9a) && (code != 0x9b))
{
/*
Initialize colormap.
*/
tile_image->colors=2;
if ((bytes_per_line & 0x8000) != 0)
{
(void) ReadBlobMSBLong(image);
flags=1L*ReadBlobMSBShort(image);
tile_image->colors=1UL*ReadBlobMSBShort(image)+1;
}
status=AcquireImageColormap(tile_image,tile_image->colors,
exception);
if (status == MagickFalse)
{
tile_image=DestroyImage(tile_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if ((bytes_per_line & 0x8000) != 0)
{
for (i=0; i < (ssize_t) tile_image->colors; i++)
{
j=ReadBlobMSBShort(image) % tile_image->colors;
if ((flags & 0x8000) != 0)
j=(size_t) i;
tile_image->colormap[j].red=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
tile_image->colormap[j].green=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
tile_image->colormap[j].blue=(Quantum)
ScaleShortToQuantum(ReadBlobMSBShort(image));
}
}
else
{
for (i=0; i < (ssize_t) tile_image->colors; i++)
{
tile_image->colormap[i].red=(Quantum) (QuantumRange-
tile_image->colormap[i].red);
tile_image->colormap[i].green=(Quantum) (QuantumRange-
tile_image->colormap[i].green);
tile_image->colormap[i].blue=(Quantum) (QuantumRange-
tile_image->colormap[i].blue);
}
}
}
if (ReadRectangle(image,&source) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (ReadRectangle(image,&destination) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
(void) ReadBlobMSBShort(image);
if ((code == 0x91) || (code == 0x99) || (code == 0x9b))
{
/*
Skip region.
*/
length=ReadBlobMSBShort(image);
for (i=0; i < (ssize_t) (length-2); i++)
if (ReadBlobByte(image) == EOF)
break;
}
if ((code != 0x9a) && (code != 0x9b) &&
(bytes_per_line & 0x8000) == 0)
pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1,&extent,
exception);
else
pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1U*
pixmap.bits_per_pixel,&extent,exception);
if (pixels == (unsigned char *) NULL)
{
tile_image=DestroyImage(tile_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
/*
Convert PICT tile image to pixel packets.
*/
p=pixels;
for (y=0; y < (ssize_t) tile_image->rows; y++)
{
if (p > (pixels+extent+image->columns))
ThrowReaderException(CorruptImageError,"NotEnoughPixelData");
q=QueueAuthenticPixels(tile_image,0,y,tile_image->columns,1,
exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) tile_image->columns; x++)
{
if (tile_image->storage_class == PseudoClass)
{
index=ConstrainColormapIndex(tile_image,*p,exception);
SetPixelIndex(tile_image,index,q);
SetPixelRed(tile_image,
tile_image->colormap[(ssize_t) index].red,q);
SetPixelGreen(tile_image,
tile_image->colormap[(ssize_t) index].green,q);
SetPixelBlue(tile_image,
tile_image->colormap[(ssize_t) index].blue,q);
}
else
{
if (pixmap.bits_per_pixel == 16)
{
i=(*p++);
j=(*p);
SetPixelRed(tile_image,ScaleCharToQuantum(
(unsigned char) ((i & 0x7c) << 1)),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
(unsigned char) (((i & 0x03) << 6) |
((j & 0xe0) >> 2))),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
(unsigned char) ((j & 0x1f) << 3)),q);
}
else
if (tile_image->alpha_trait == UndefinedPixelTrait)
{
if (p > (pixels+extent+2*image->columns))
ThrowReaderException(CorruptImageError,
"NotEnoughPixelData");
SetPixelRed(tile_image,ScaleCharToQuantum(*p),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
*(p+tile_image->columns)),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
*(p+2*tile_image->columns)),q);
}
else
{
if (p > (pixels+extent+3*image->columns))
ThrowReaderException(CorruptImageError,
"NotEnoughPixelData");
SetPixelAlpha(tile_image,ScaleCharToQuantum(*p),q);
SetPixelRed(tile_image,ScaleCharToQuantum(
*(p+tile_image->columns)),q);
SetPixelGreen(tile_image,ScaleCharToQuantum(
*(p+2*tile_image->columns)),q);
SetPixelBlue(tile_image,ScaleCharToQuantum(
*(p+3*tile_image->columns)),q);
}
}
p++;
q+=GetPixelChannels(tile_image);
}
if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)
break;
if ((tile_image->storage_class == DirectClass) &&
(pixmap.bits_per_pixel != 16))
{
p+=(pixmap.component_count-1)*tile_image->columns;
if (p < pixels)
break;
}
status=SetImageProgress(image,LoadImageTag,y,tile_image->rows);
if (status == MagickFalse)
break;
}
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
if (jpeg == MagickFalse)
if ((code == 0x9a) || (code == 0x9b) ||
((bytes_per_line & 0x8000) != 0))
(void) CompositeImage(image,tile_image,CopyCompositeOp,
MagickTrue,destination.left,destination.top,exception);
tile_image=DestroyImage(tile_image);
break;
}
case 0xa1:
{
unsigned char
*info;
size_t
type;
/*
Comment.
*/
type=ReadBlobMSBShort(image);
length=ReadBlobMSBShort(image);
if (length == 0)
break;
(void) ReadBlobMSBLong(image);
length-=4;
if (length == 0)
break;
info=(unsigned char *) AcquireQuantumMemory(length,sizeof(*info));
if (info == (unsigned char *) NULL)
break;
count=ReadBlob(image,length,info);
if (count != (ssize_t) length)
ThrowReaderException(ResourceLimitError,"UnableToReadImageData");
switch (type)
{
case 0xe0:
{
if (length == 0)
break;
profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"icc",profile,exception);
profile=DestroyStringInfo(profile);
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
break;
}
case 0x1f2:
{
if (length == 0)
break;
profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"iptc",profile,exception);
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
profile=DestroyStringInfo(profile);
break;
}
default:
break;
}
info=(unsigned char *) RelinquishMagickMemory(info);
break;
}
default:
{
/*
Skip to next op code.
*/
if (code < 0)
break;
if (codes[code].length == -1)
(void) ReadBlobMSBShort(image);
else
for (i=0; i < (ssize_t) codes[code].length; i++)
if (ReadBlobByte(image) == EOF)
break;
}
}
}
if (code == 0xc00)
{
/*
Skip header.
*/
for (i=0; i < 24; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
if (((code >= 0xb0) && (code <= 0xcf)) ||
((code >= 0x8000) && (code <= 0x80ff)))
continue;
if (code == 0x8200)
{
FILE
*file;
Image
*tile_image;
ImageInfo
*read_info;
int
unique_file;
/*
Embedded JPEG.
*/
jpeg=MagickTrue;
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(read_info->filename);
if (unique_file != -1)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
{
(void) RelinquishUniqueFileResource(read_info->filename);
(void) CopyMagickString(image->filename,read_info->filename,
MagickPathExtent);
ThrowFileException(exception,FileOpenError,
"UnableToCreateTemporaryFile",image->filename);
image=DestroyImageList(image);
return((Image *) NULL);
}
length=ReadBlobMSBLong(image);
if (length > 154)
{
for (i=0; i < 6; i++)
(void) ReadBlobMSBLong(image);
if (ReadRectangle(image,&frame) == MagickFalse)
{
(void) fclose(file);
(void) RelinquishUniqueFileResource(read_info->filename);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
for (i=0; i < 122; i++)
if (ReadBlobByte(image) == EOF)
break;
for (i=0; i < (ssize_t) (length-154); i++)
{
c=ReadBlobByte(image);
if (c == EOF)
break;
(void) fputc(c,file);
}
}
(void) fclose(file);
(void) close(unique_file);
tile_image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
read_info=DestroyImageInfo(read_info);
if (tile_image == (Image *) NULL)
continue;
(void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",
(double) MagickMax(image->columns,tile_image->columns),
(double) MagickMax(image->rows,tile_image->rows));
(void) SetImageExtent(image,
MagickMax(image->columns,tile_image->columns),
MagickMax(image->rows,tile_image->rows),exception);
(void) TransformImageColorspace(image,tile_image->colorspace,exception);
(void) CompositeImage(image,tile_image,CopyCompositeOp,MagickTrue,
frame.left,frame.right,exception);
image->compression=tile_image->compression;
tile_image=DestroyImage(tile_image);
continue;
}
if ((code == 0xff) || (code == 0xffff))
break;
if (((code >= 0xd0) && (code <= 0xfe)) ||
((code >= 0x8100) && (code <= 0xffff)))
{
/*
Skip reserved.
*/
length=ReadBlobMSBShort(image);
for (i=0; i < (ssize_t) length; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
if ((code >= 0x100) && (code <= 0x7fff))
{
/*
Skip reserved.
*/
length=(size_t) ((code >> 7) & 0xff);
for (i=0; i < (ssize_t) length; i++)
if (ReadBlobByte(image) == EOF)
break;
continue;
}
}
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
| 3,663 |
136,518 | 0 | static FloatRect ComputeRightDelta(const FloatPoint& location,
const FloatSize& old_size,
const FloatSize& new_size) {
float delta = new_size.Width() - old_size.Width();
if (delta > 0) {
return FloatRect(location.X() + old_size.Width(), location.Y(), delta,
new_size.Height());
}
if (delta < 0) {
return FloatRect(location.X() + new_size.Width(), location.Y(), -delta,
old_size.Height());
}
return FloatRect();
}
| 3,664 |
9,894 | 0 | KConfigSkeleton *Part::config() const
{
return ArkSettings::self();
}
| 3,665 |
157,478 | 0 | base::string16 GetProfileIdFromPath(const base::FilePath& profile_path) {
if (profile_path.empty())
return base::string16();
base::FilePath default_user_data_dir;
if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir) &&
profile_path.DirName() == default_user_data_dir &&
profile_path.BaseName().value() ==
base::ASCIIToUTF16(chrome::kInitialProfile)) {
return base::string16();
}
base::string16 basenames = profile_path.DirName().BaseName().value() +
L"." + profile_path.BaseName().value();
base::string16 profile_id;
profile_id.reserve(basenames.size());
for (size_t i = 0; i < basenames.length(); ++i) {
if (base::IsAsciiAlpha(basenames[i]) ||
base::IsAsciiDigit(basenames[i]) ||
basenames[i] == L'.')
profile_id += basenames[i];
}
return profile_id;
}
| 3,666 |
170,582 | 0 | void VirtualizerGetSpeakerAngles(audio_channel_mask_t channelMask __unused,
audio_devices_t deviceType __unused, int32_t *pSpeakerAngles) {
*pSpeakerAngles++ = (int32_t) AUDIO_CHANNEL_OUT_FRONT_LEFT;
*pSpeakerAngles++ = -90; // azimuth
*pSpeakerAngles++ = 0; // elevation
*pSpeakerAngles++ = (int32_t) AUDIO_CHANNEL_OUT_FRONT_RIGHT;
*pSpeakerAngles++ = 90; // azimuth
*pSpeakerAngles = 0; // elevation
}
| 3,667 |
30,729 | 0 | static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio)
{
struct rfcomm_dlc *d;
struct sock *sk;
sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto);
if (!sk)
return NULL;
sock_init_data(sock, sk);
INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
d = rfcomm_dlc_alloc(prio);
if (!d) {
sk_free(sk);
return NULL;
}
d->data_ready = rfcomm_sk_data_ready;
d->state_change = rfcomm_sk_state_change;
rfcomm_pi(sk)->dlc = d;
d->owner = sk;
sk->sk_destruct = rfcomm_sock_destruct;
sk->sk_sndtimeo = RFCOMM_CONN_TIMEOUT;
sk->sk_sndbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10;
sk->sk_rcvbuf = RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 10;
sock_reset_flag(sk, SOCK_ZAPPED);
sk->sk_protocol = proto;
sk->sk_state = BT_OPEN;
bt_sock_link(&rfcomm_sk_list, sk);
BT_DBG("sk %p", sk);
return sk;
}
| 3,668 |
50,641 | 0 | static void srpt_cm_rep_error(struct ib_cm_id *cm_id)
{
pr_info("Received IB REP error for cm_id %p.\n", cm_id);
srpt_drain_channel(cm_id);
}
| 3,669 |
42,940 | 0 | static void sctp_v4_get_saddr(struct sctp_sock *sk,
struct sctp_transport *t,
struct flowi *fl)
{
union sctp_addr *saddr = &t->saddr;
struct rtable *rt = (struct rtable *)t->dst;
if (rt) {
saddr->v4.sin_family = AF_INET;
saddr->v4.sin_addr.s_addr = fl->u.ip4.saddr;
}
}
| 3,670 |
76,241 | 0 | static int cdrom_ioctl_reset(struct cdrom_device_info *cdi,
struct block_device *bdev)
{
cd_dbg(CD_DO_IOCTL, "entering CDROM_RESET\n");
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (!CDROM_CAN(CDC_RESET))
return -ENOSYS;
invalidate_bdev(bdev);
return cdi->ops->reset(cdi);
}
| 3,671 |
91,798 | 0 | void comps_objrtree_destroy_u(COMPS_Object *obj) {
comps_objrtree_destroy((COMPS_ObjRTree*)obj);
}
| 3,672 |
123,495 | 0 | void SafeBrowsingBlockingPageV2::PopulateStringDictionary(
DictionaryValue* strings,
const string16& title,
const string16& headline,
const string16& description1,
const string16& description2,
const string16& description3) {
strings->SetString("title", title);
strings->SetString("headLine", headline);
strings->SetString("description1", description1);
strings->SetString("description2", description2);
strings->SetString("description3", description3);
strings->SetBoolean("proceedDisabled",
IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled));
strings->SetBoolean("isMainFrame", is_main_frame_load_blocked_);
strings->SetBoolean("isPhishing", interstitial_type_ == TYPE_PHISHING);
strings->SetString("back_button",
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
strings->SetString("seeMore", l10n_util::GetStringUTF16(
IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE));
strings->SetString("proceed",
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK));
URLDataSource::SetFontAndTextDirection(strings);
}
| 3,673 |
160,951 | 0 | void ChromeClientImpl::DidOverscroll(const FloatSize& overscroll_delta,
const FloatSize& accumulated_overscroll,
const FloatPoint& position_in_viewport,
const FloatSize& velocity_in_viewport,
const WebOverscrollBehavior& behavior) {
if (!web_view_->Client())
return;
web_view_->Client()->DidOverscroll(overscroll_delta, accumulated_overscroll,
position_in_viewport, velocity_in_viewport,
behavior);
}
| 3,674 |
26,659 | 0 | static int get_rdev_dev_by_info_ifindex(struct genl_info *info,
struct cfg80211_registered_device **rdev,
struct net_device **dev)
{
struct nlattr **attrs = info->attrs;
int ifindex;
if (!attrs[NL80211_ATTR_IFINDEX])
return -EINVAL;
ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
*dev = dev_get_by_index(genl_info_net(info), ifindex);
if (!*dev)
return -ENODEV;
*rdev = cfg80211_get_dev_from_ifindex(genl_info_net(info), ifindex);
if (IS_ERR(*rdev)) {
dev_put(*dev);
return PTR_ERR(*rdev);
}
return 0;
}
| 3,675 |
160,571 | 0 | WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation(
const NavigationPolicyInfo& info) {
bool is_content_initiated =
info.extra_data ? static_cast<DocumentState*>(info.extra_data)
->navigation_state()
->IsContentInitiated()
: !IsBrowserInitiated(pending_navigation_params_.get());
const GURL& url = info.url_request.Url();
bool is_redirect =
info.extra_data ||
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty() &&
url != pending_navigation_params_->request_params.redirects[0]);
#ifdef OS_ANDROID
bool render_view_was_created_by_renderer =
render_view_->was_created_by_renderer_;
if (!IsURLHandledByNetworkStack(url) &&
GetContentClient()->renderer()->HandleNavigation(
this, is_content_initiated, render_view_was_created_by_renderer,
frame_, info.url_request, info.navigation_type, info.default_policy,
is_redirect)) {
return blink::kWebNavigationPolicyIgnore;
}
#endif
if (is_content_initiated && IsTopLevelNavigation(frame_) &&
render_view_->renderer_preferences_
.browser_handles_all_top_level_requests) {
OpenURL(info, /*send_referrer=*/true,
/*is_history_navigation_in_new_child=*/false);
return blink::kWebNavigationPolicyIgnore; // Suppress the load here.
}
if (info.is_history_navigation_in_new_child_frame && is_content_initiated &&
frame_->Parent()) {
bool should_ask_browser = false;
RenderFrameImpl* parent = RenderFrameImpl::FromWebFrame(frame_->Parent());
auto iter = parent->history_subframe_unique_names_.find(
unique_name_helper_.value());
if (iter != parent->history_subframe_unique_names_.end()) {
bool history_item_is_about_blank = iter->second;
should_ask_browser =
!history_item_is_about_blank || url != url::kAboutBlankURL;
parent->history_subframe_unique_names_.erase(iter);
}
if (should_ask_browser) {
if (!info.is_client_redirect) {
OpenURL(info, /*send_referrer=*/true,
/*is_history_navigation_in_new_child=*/true);
return blink::kWebNavigationPolicyHandledByClientForInitialHistory;
} else {
GetFrameHost()->CancelInitialHistoryLoad();
}
}
}
GURL old_url(frame_->GetDocumentLoader()->GetRequest().Url());
if (!frame_->Parent() && is_content_initiated &&
!url.SchemeIs(url::kAboutScheme)) {
bool send_referrer = false;
int cumulative_bindings = RenderProcess::current()->GetEnabledBindings();
bool is_initial_navigation = render_view_->history_list_length_ == 0;
bool should_fork =
HasWebUIScheme(url) || HasWebUIScheme(old_url) ||
(cumulative_bindings & BINDINGS_POLICY_WEB_UI) ||
url.SchemeIs(kViewSourceScheme) ||
(frame_->IsViewSourceModeEnabled() &&
info.navigation_type != blink::kWebNavigationTypeReload);
if (!should_fork && url.SchemeIs(url::kFileScheme)) {
should_fork = !old_url.SchemeIs(url::kFileScheme);
}
if (!should_fork) {
should_fork = GetContentClient()->renderer()->ShouldFork(
frame_, url, info.url_request.HttpMethod().Utf8(),
is_initial_navigation, is_redirect, &send_referrer);
}
if (should_fork) {
OpenURL(info, send_referrer,
/*is_history_navigation_in_new_child=*/false);
return blink::kWebNavigationPolicyIgnore; // Suppress the load here.
}
}
bool is_fork =
old_url == url::kAboutBlankURL &&
render_view_->HistoryBackListCount() < 1 &&
render_view_->HistoryForwardListCount() < 1 &&
frame_->Opener() == nullptr &&
frame_->Parent() == nullptr &&
is_content_initiated &&
info.default_policy == blink::kWebNavigationPolicyCurrentTab &&
info.navigation_type == blink::kWebNavigationTypeOther;
if (is_fork) {
OpenURL(info, /*send_referrer=*/false,
/*is_history_navigation_in_new_child=*/false);
return blink::kWebNavigationPolicyIgnore;
}
bool should_dispatch_before_unload =
info.default_policy == blink::kWebNavigationPolicyCurrentTab &&
!is_redirect &&
info.url_request.CheckForBrowserSideNavigation() &&
(has_accessed_initial_document_ || !current_history_item_.IsNull());
if (should_dispatch_before_unload) {
base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr();
if (!frame_->DispatchBeforeUnloadEvent(info.navigation_type ==
blink::kWebNavigationTypeReload) ||
!weak_self) {
return blink::kWebNavigationPolicyIgnore;
}
if (pending_navigation_params_) {
pending_navigation_params_->common_params.navigation_start =
base::TimeTicks::Now();
}
}
bool use_archive =
(info.archive_status == NavigationPolicyInfo::ArchiveStatus::Present) &&
!url.SchemeIs(url::kDataScheme);
if (info.url_request.CheckForBrowserSideNavigation() &&
IsURLHandledByNetworkStack(url) && !use_archive) {
if (info.default_policy == blink::kWebNavigationPolicyCurrentTab) {
pending_navigation_info_.reset(new PendingNavigationInfo(info));
return blink::kWebNavigationPolicyHandledByClient;
} else if (info.default_policy == blink::kWebNavigationPolicyDownload) {
DownloadURL(info.url_request, blink::WebString());
return blink::kWebNavigationPolicyIgnore;
} else {
OpenURL(info, /*send_referrer=*/true,
/*is_history_navigation_in_new_child=*/false);
return blink::kWebNavigationPolicyIgnore;
}
}
if (info.default_policy == blink::kWebNavigationPolicyCurrentTab ||
info.default_policy == blink::kWebNavigationPolicyDownload) {
return info.default_policy;
}
OpenURL(info, /*send_referrer=*/true,
/*is_history_navigation_in_new_child=*/false);
return blink::kWebNavigationPolicyIgnore;
}
| 3,676 |
81,557 | 0 | int create_event_filter(struct trace_event_call *call,
char *filter_str, bool set_str,
struct event_filter **filterp)
{
return create_filter(call, filter_str, set_str, filterp);
}
| 3,677 |
53,850 | 0 | int acpi_os_map_generic_address(struct acpi_generic_address *gas)
{
u64 addr;
void __iomem *virt;
if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
return 0;
/* Handle possible alignment issues */
memcpy(&addr, &gas->address, sizeof(addr));
if (!addr || !gas->bit_width)
return -EINVAL;
virt = acpi_os_map_iomem(addr, gas->bit_width / 8);
if (!virt)
return -EIO;
return 0;
}
| 3,678 |
21,363 | 0 | static void mincore_unmapped_range(struct vm_area_struct *vma,
unsigned long addr, unsigned long end,
unsigned char *vec)
{
unsigned long nr = (end - addr) >> PAGE_SHIFT;
int i;
if (vma->vm_file) {
pgoff_t pgoff;
pgoff = linear_page_index(vma, addr);
for (i = 0; i < nr; i++, pgoff++)
vec[i] = mincore_page(vma->vm_file->f_mapping, pgoff);
} else {
for (i = 0; i < nr; i++)
vec[i] = 0;
}
}
| 3,679 |
107,763 | 0 | void FrameLoader::ReplaceDocumentWhileExecutingJavaScriptURL(
const String& source,
Document* owner_document) {
Document* document = frame_->GetDocument();
if (!document_loader_ ||
document->PageDismissalEventBeingDispatched() != Document::kNoDismissal)
return;
UseCounter::Count(*document, WebFeature::kReplaceDocumentViaJavaScriptURL);
const KURL& url = document->Url();
WebGlobalObjectReusePolicy global_object_reuse_policy =
ShouldReuseDefaultView(url, document->GetContentSecurityPolicy())
? WebGlobalObjectReusePolicy::kUseExisting
: WebGlobalObjectReusePolicy::kCreateNew;
document_loader_->StopLoading();
DetachDocumentLoader(provisional_document_loader_);
frame_->GetNavigationScheduler().Cancel();
SubframeLoadingDisabler disabler(document);
IgnoreOpensDuringUnloadCountIncrementer ignore_opens_during_unload(document);
frame_->DetachChildren();
if (!frame_->IsAttached() || document != frame_->GetDocument())
return;
frame_->GetDocument()->Shutdown();
Client()->TransitionToCommittedForNewPage();
document_loader_->ReplaceDocumentWhileExecutingJavaScriptURL(
url, owner_document, global_object_reuse_policy, source);
}
| 3,680 |
133,982 | 0 | bool AppListSyncableService::ProcessSyncItemSpecifics(
const sync_pb::AppListSpecifics& specifics) {
const std::string& item_id = specifics.item_id();
if (item_id.empty()) {
LOG(ERROR) << "AppList item with empty ID";
return false;
}
SyncItem* sync_item = FindSyncItem(item_id);
if (sync_item) {
if (sync_item->item_type == specifics.item_type()) {
UpdateSyncItemFromSync(specifics, sync_item);
ProcessExistingSyncItem(sync_item);
VLOG(2) << this << " <- SYNC UPDATE: " << sync_item->ToString();
return false;
}
if (sync_item->item_type !=
sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP &&
specifics.item_type() !=
sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP) {
LOG(ERROR) << "Synced item type: " << specifics.item_type()
<< " != existing sync item type: " << sync_item->item_type
<< " Deleting item from model!";
model_->DeleteItem(item_id);
}
VLOG(2) << this << " - ProcessSyncItem: Delete existing entry: "
<< sync_item->ToString();
delete sync_item;
sync_items_.erase(item_id);
}
sync_item = CreateSyncItem(item_id, specifics.item_type());
UpdateSyncItemFromSync(specifics, sync_item);
ProcessNewSyncItem(sync_item);
VLOG(2) << this << " <- SYNC ADD: " << sync_item->ToString();
return true;
}
| 3,681 |
25,378 | 0 | mipspmu_perf_event_encode(const struct mips_perf_event *pev)
{
/*
* Top 8 bits for range, next 16 bits for cntr_mask, lowest 8 bits for
* event_id.
*/
#ifdef CONFIG_MIPS_MT_SMP
return ((unsigned int)pev->range << 24) |
(pev->cntr_mask & 0xffff00) |
(pev->event_id & 0xff);
#else
return (pev->cntr_mask & 0xffff00) |
(pev->event_id & 0xff);
#endif
}
| 3,682 |
188,441 | 1 | long ContentEncoding::ParseContentEncodingEntry(long long start,
long long size,
IMkvReader* pReader) {
assert(pReader);
long long pos = start;
const long long stop = start + size;
// Count ContentCompression and ContentEncryption elements.
int compression_count = 0;
int encryption_count = 0;
while (pos < stop) {
long long id, size;
const long status = ParseElementHeader(pReader,
pos,
stop,
id,
size);
if (status < 0) //error
return status;
if (id == 0x1034) // ContentCompression ID
++compression_count;
if (id == 0x1035) // ContentEncryption ID
++encryption_count;
pos += size; //consume payload
assert(pos <= stop);
}
if (compression_count <= 0 && encryption_count <= 0)
return -1;
if (compression_count > 0) {
compression_entries_ =
new (std::nothrow) ContentCompression*[compression_count];
if (!compression_entries_)
return -1;
compression_entries_end_ = compression_entries_;
}
if (encryption_count > 0) {
encryption_entries_ =
new (std::nothrow) ContentEncryption*[encryption_count];
if (!encryption_entries_) {
delete [] compression_entries_;
return -1;
}
encryption_entries_end_ = encryption_entries_;
}
pos = start;
while (pos < stop) {
long long id, size;
long status = ParseElementHeader(pReader,
pos,
stop,
id,
size);
if (status < 0) //error
return status;
if (id == 0x1031) {
// ContentEncodingOrder
encoding_order_ = UnserializeUInt(pReader, pos, size);
} else if (id == 0x1032) {
// ContentEncodingScope
encoding_scope_ = UnserializeUInt(pReader, pos, size);
if (encoding_scope_ < 1)
return -1;
} else if (id == 0x1033) {
// ContentEncodingType
encoding_type_ = UnserializeUInt(pReader, pos, size);
} else if (id == 0x1034) {
// ContentCompression ID
ContentCompression* const compression =
new (std::nothrow) ContentCompression();
if (!compression)
return -1;
status = ParseCompressionEntry(pos, size, pReader, compression);
if (status) {
delete compression;
return status;
}
*compression_entries_end_++ = compression;
} else if (id == 0x1035) {
// ContentEncryption ID
ContentEncryption* const encryption =
new (std::nothrow) ContentEncryption();
if (!encryption)
return -1;
status = ParseEncryptionEntry(pos, size, pReader, encryption);
if (status) {
delete encryption;
return status;
}
*encryption_entries_end_++ = encryption;
}
pos += size; //consume payload
assert(pos <= stop);
}
assert(pos == stop);
return 0;
}
| 3,683 |
114,595 | 0 | void RenderThreadImpl::OnDOMStorageEvent(
const DOMStorageMsg_Event_Params& params) {
if (!dom_storage_event_dispatcher_.get()) {
EnsureWebKitInitialized();
dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create());
}
dom_storage_event_dispatcher_->dispatchStorageEvent(params.key,
params.old_value, params.new_value, params.origin, params.page_url,
params.namespace_id == dom_storage::kLocalStorageNamespaceId);
}
| 3,684 |
47,730 | 0 | static void do_one_broadcast(struct sock *sk,
struct netlink_broadcast_data *p)
{
struct netlink_sock *nlk = nlk_sk(sk);
int val;
if (p->exclude_sk == sk)
return;
if (nlk->portid == p->portid || p->group - 1 >= nlk->ngroups ||
!test_bit(p->group - 1, nlk->groups))
return;
if (!net_eq(sock_net(sk), p->net)) {
if (!(nlk->flags & NETLINK_F_LISTEN_ALL_NSID))
return;
if (!peernet_has_id(sock_net(sk), p->net))
return;
if (!file_ns_capable(sk->sk_socket->file, p->net->user_ns,
CAP_NET_BROADCAST))
return;
}
if (p->failure) {
netlink_overrun(sk);
return;
}
sock_hold(sk);
if (p->skb2 == NULL) {
if (skb_shared(p->skb)) {
p->skb2 = skb_clone(p->skb, p->allocation);
} else {
p->skb2 = skb_get(p->skb);
/*
* skb ownership may have been set when
* delivered to a previous socket.
*/
skb_orphan(p->skb2);
}
}
if (p->skb2 == NULL) {
netlink_overrun(sk);
/* Clone failed. Notify ALL listeners. */
p->failure = 1;
if (nlk->flags & NETLINK_F_BROADCAST_SEND_ERROR)
p->delivery_failure = 1;
goto out;
}
if (p->tx_filter && p->tx_filter(sk, p->skb2, p->tx_data)) {
kfree_skb(p->skb2);
p->skb2 = NULL;
goto out;
}
if (sk_filter(sk, p->skb2)) {
kfree_skb(p->skb2);
p->skb2 = NULL;
goto out;
}
NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
NETLINK_CB(p->skb2).nsid_is_set = true;
val = netlink_broadcast_deliver(sk, p->skb2);
if (val < 0) {
netlink_overrun(sk);
if (nlk->flags & NETLINK_F_BROADCAST_SEND_ERROR)
p->delivery_failure = 1;
} else {
p->congested |= val;
p->delivered = 1;
p->skb2 = NULL;
}
out:
sock_put(sk);
}
| 3,685 |
116,412 | 0 | bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() {
return false;
}
| 3,686 |
125,695 | 0 | void RenderViewHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
delegate_->UpdateEncoding(this, encoding_name);
}
| 3,687 |
82,087 | 0 | mrb_define_module_id(mrb_state *mrb, mrb_sym name)
{
return define_module(mrb, name, mrb->object_class);
}
| 3,688 |
188,107 | 1 | IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_hdr(dec_state_t *ps_dec)
{
stream_t *ps_stream;
ps_stream = &ps_dec->s_bit_stream;
UWORD16 u2_height;
UWORD16 u2_width;
if (impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN) != SEQUENCE_HEADER_CODE)
{
impeg2d_bit_stream_flush(ps_stream,START_CODE_LEN);
return IMPEG2D_FRM_HDR_START_CODE_NOT_FOUND;
}
impeg2d_bit_stream_flush(ps_stream,START_CODE_LEN);
u2_width = impeg2d_bit_stream_get(ps_stream,12);
u2_height = impeg2d_bit_stream_get(ps_stream,12);
if (0 == u2_width || 0 == u2_height)
{
IMPEG2D_ERROR_CODES_T e_error = IMPEG2D_FRM_HDR_DECODE_ERR;
return e_error;
}
if ((u2_width != ps_dec->u2_horizontal_size)
|| (u2_height != ps_dec->u2_vertical_size))
{
if (0 == ps_dec->u2_header_done)
{
/* This is the first time we are reading the resolution */
ps_dec->u2_horizontal_size = u2_width;
ps_dec->u2_vertical_size = u2_height;
if (0 == ps_dec->u4_frm_buf_stride)
{
ps_dec->u4_frm_buf_stride = (UWORD32) (u2_width);
}
}
else
{
if (0 == ps_dec->i4_pic_count)
{
/* Decoder has not decoded a single frame since the last
* reset/init. This implies that we have two headers in the
* input stream. So, do not indicate a resolution change, since
* this can take the decoder into an infinite loop.
*/
return (IMPEG2D_ERROR_CODES_T) IMPEG2D_FRM_HDR_DECODE_ERR;
}
else if((u2_width > ps_dec->u2_create_max_width)
|| (u2_height > ps_dec->u2_create_max_height))
{
IMPEG2D_ERROR_CODES_T e_error = IMPEG2D_UNSUPPORTED_DIMENSIONS;
ps_dec->u2_reinit_max_height = u2_height;
ps_dec->u2_reinit_max_width = u2_width;
return e_error;
}
else
{
/* The resolution has changed */
return (IMPEG2D_ERROR_CODES_T)IVD_RES_CHANGED;
}
}
}
if((ps_dec->u2_horizontal_size > ps_dec->u2_create_max_width)
|| (ps_dec->u2_vertical_size > ps_dec->u2_create_max_height))
{
IMPEG2D_ERROR_CODES_T e_error = IMPEG2D_UNSUPPORTED_DIMENSIONS;
ps_dec->u2_reinit_max_height = ps_dec->u2_vertical_size;
ps_dec->u2_reinit_max_width = ps_dec->u2_horizontal_size;
return e_error;
}
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
/* aspect_ratio_info (4 bits) */
/*------------------------------------------------------------------------*/
ps_dec->u2_aspect_ratio_info = impeg2d_bit_stream_get(ps_stream,4);
/*------------------------------------------------------------------------*/
/* Frame rate code(4 bits) */
/*------------------------------------------------------------------------*/
ps_dec->u2_frame_rate_code = impeg2d_bit_stream_get(ps_stream,4);
if (ps_dec->u2_frame_rate_code > MPEG2_MAX_FRAME_RATE_CODE)
{
return IMPEG2D_FRM_HDR_DECODE_ERR;
}
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
/* bit_rate_value (18 bits) */
/*------------------------------------------------------------------------*/
impeg2d_bit_stream_flush(ps_stream,18);
GET_MARKER_BIT(ps_dec,ps_stream);
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
/* vbv_buffer_size_value(10 bits), constrained_parameter_flag (1 bit) */
/*------------------------------------------------------------------------*/
impeg2d_bit_stream_flush(ps_stream,11);
/*------------------------------------------------------------------------*/
/* Quantization matrix for the intra blocks */
/*------------------------------------------------------------------------*/
if(impeg2d_bit_stream_get_bit(ps_stream) == 1)
{
UWORD16 i;
for(i = 0; i < NUM_PELS_IN_BLOCK; i++)
{
ps_dec->au1_intra_quant_matrix[gau1_impeg2_inv_scan_zig_zag[i]] = (UWORD8)impeg2d_bit_stream_get(ps_stream,8);
}
}
else
{
memcpy(ps_dec->au1_intra_quant_matrix,gau1_impeg2_intra_quant_matrix_default,
NUM_PELS_IN_BLOCK);
}
/*------------------------------------------------------------------------*/
/* Quantization matrix for the inter blocks */
/*------------------------------------------------------------------------*/
if(impeg2d_bit_stream_get_bit(ps_stream) == 1)
{
UWORD16 i;
for(i = 0; i < NUM_PELS_IN_BLOCK; i++)
{
ps_dec->au1_inter_quant_matrix[gau1_impeg2_inv_scan_zig_zag[i]] = (UWORD8)impeg2d_bit_stream_get(ps_stream,8);
}
}
else
{
memcpy(ps_dec->au1_inter_quant_matrix,gau1_impeg2_inter_quant_matrix_default,
NUM_PELS_IN_BLOCK);
}
impeg2d_next_start_code(ps_dec);
return (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE;
}
| 3,689 |
24,833 | 0 | void __init kmem_cache_init(void)
{
int i;
int caches = 0;
init_alloc_cpu();
#ifdef CONFIG_NUMA
/*
* Must first have the slab cache available for the allocations of the
* struct kmem_cache_node's. There is special bootstrap code in
* kmem_cache_open for slab_state == DOWN.
*/
create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node",
sizeof(struct kmem_cache_node), GFP_KERNEL);
kmalloc_caches[0].refcount = -1;
caches++;
hotplug_memory_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
#endif
/* Able to allocate the per node structures */
slab_state = PARTIAL;
/* Caches that are not of the two-to-the-power-of size */
if (KMALLOC_MIN_SIZE <= 64) {
create_kmalloc_cache(&kmalloc_caches[1],
"kmalloc-96", 96, GFP_KERNEL);
caches++;
}
if (KMALLOC_MIN_SIZE <= 128) {
create_kmalloc_cache(&kmalloc_caches[2],
"kmalloc-192", 192, GFP_KERNEL);
caches++;
}
for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++) {
create_kmalloc_cache(&kmalloc_caches[i],
"kmalloc", 1 << i, GFP_KERNEL);
caches++;
}
/*
* Patch up the size_index table if we have strange large alignment
* requirements for the kmalloc array. This is only the case for
* MIPS it seems. The standard arches will not generate any code here.
*
* Largest permitted alignment is 256 bytes due to the way we
* handle the index determination for the smaller caches.
*
* Make sure that nothing crazy happens if someone starts tinkering
* around with ARCH_KMALLOC_MINALIGN
*/
BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 ||
(KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1)));
for (i = 8; i < KMALLOC_MIN_SIZE; i += 8)
size_index[(i - 1) / 8] = KMALLOC_SHIFT_LOW;
slab_state = UP;
/* Provide the correct kmalloc names now that the caches are up */
for (i = KMALLOC_SHIFT_LOW; i <= PAGE_SHIFT; i++)
kmalloc_caches[i]. name =
kasprintf(GFP_KERNEL, "kmalloc-%d", 1 << i);
#ifdef CONFIG_SMP
register_cpu_notifier(&slab_notifier);
kmem_size = offsetof(struct kmem_cache, cpu_slab) +
nr_cpu_ids * sizeof(struct kmem_cache_cpu *);
#else
kmem_size = sizeof(struct kmem_cache);
#endif
printk(KERN_INFO
"SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
" CPUs=%d, Nodes=%d\n",
caches, cache_line_size(),
slub_min_order, slub_max_order, slub_min_objects,
nr_cpu_ids, nr_node_ids);
}
| 3,690 |
129,905 | 0 | void SpeechSynthesis::startSpeakingImmediately()
{
SpeechSynthesisUtterance* utterance = currentSpeechUtterance();
ASSERT(utterance);
utterance->setStartTime(monotonicallyIncreasingTime());
m_isPaused = false;
m_platformSpeechSynthesizer->speak(utterance->platformUtterance());
}
| 3,691 |
38,148 | 0 | static void magicmouse_input_configured(struct hid_device *hdev,
struct hid_input *hi)
{
struct magicmouse_sc *msc = hid_get_drvdata(hdev);
int ret = magicmouse_setup_input(msc->input, hdev);
if (ret) {
hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
/* clean msc->input to notify probe() of the failure */
msc->input = NULL;
}
}
| 3,692 |
150,501 | 0 | void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown(
const GURL& url,
const std::string& reason,
int net_error_code) {
api::safe_browsing_private::InterstitialInfo params;
params.url = url.spec();
params.reason = reason;
if (net_error_code < 0) {
params.net_error_code =
std::make_unique<std::string>(base::NumberToString(net_error_code));
}
params.user_name = GetProfileUserName();
if (event_router_) {
auto event_value = std::make_unique<base::ListValue>();
event_value->Append(params.ToValue());
auto extension_event = std::make_unique<Event>(
events::SAFE_BROWSING_PRIVATE_ON_SECURITY_INTERSTITIAL_SHOWN,
api::safe_browsing_private::OnSecurityInterstitialShown::kEventName,
std::move(event_value));
event_router_->BroadcastEvent(std::move(extension_event));
}
if (client_) {
base::Value event(base::Value::Type::DICTIONARY);
event.SetStringKey(kKeyUrl, params.url);
event.SetStringKey(kKeyReason, params.reason);
event.SetIntKey(kKeyNetErrorCode, net_error_code);
event.SetStringKey(kKeyProfileUserName, params.user_name);
event.SetBoolKey(kKeyClickedThrough, false);
ReportRealtimeEvent(kKeyInterstitialEvent, std::move(event));
}
}
| 3,693 |
13,454 | 0 | static void js_outofmemory(js_State *J)
{
STACK[TOP].type = JS_TLITSTR;
STACK[TOP].u.litstr = "out of memory";
++TOP;
js_throw(J);
}
| 3,694 |
66,274 | 0 | IW_IMPL(unsigned int) iw_get_ui32_e(const iw_byte *b, int endian)
{
if(endian==IW_ENDIAN_LITTLE)
return iw_get_ui32le(b);
return iw_get_ui32be(b);
}
| 3,695 |
51,250 | 0 | static PHP_NAMED_FUNCTION(zif_zip_entry_open)
{
zval * zip;
zval * zip_entry;
char *mode = NULL;
int mode_len = 0;
zip_read_rsrc * zr_rsrc;
zip_rsrc *z_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|s", &zip, &zip_entry, &mode, &mode_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(zr_rsrc, zip_read_rsrc *, &zip_entry, -1, le_zip_entry_name, le_zip_entry);
ZEND_FETCH_RESOURCE(z_rsrc, zip_rsrc *, &zip, -1, le_zip_dir_name, le_zip_dir);
if (zr_rsrc->zf != NULL) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
| 3,696 |
21,282 | 0 | static inline unsigned long zap_pud_range(struct mmu_gather *tlb,
struct vm_area_struct *vma, pgd_t *pgd,
unsigned long addr, unsigned long end,
struct zap_details *details)
{
pud_t *pud;
unsigned long next;
pud = pud_offset(pgd, addr);
do {
next = pud_addr_end(addr, end);
if (pud_none_or_clear_bad(pud))
continue;
next = zap_pmd_range(tlb, vma, pud, addr, next, details);
} while (pud++, addr = next, addr != end);
return addr;
}
| 3,697 |
169,902 | 0 | static void xsltFixImportedCompSteps(xsltStylesheetPtr master,
xsltStylesheetPtr style) {
xsltStylesheetPtr res;
xmlHashScan(style->templatesHash,
(xmlHashScanner) xsltNormalizeCompSteps, master);
master->extrasNr += style->extrasNr;
for (res = style->imports; res != NULL; res = res->next) {
xsltFixImportedCompSteps(master, res);
}
}
| 3,698 |
75,053 | 0 | map_num_persons(void)
{
return s_num_persons;
}
| 3,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.