unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
132,685 | 0 | void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title) {
Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title));
}
| 16,600 |
98,508 | 0 | AutocompletePopupViewGtk::AutocompletePopupViewGtk(
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
GtkWidget* location_bar)
: model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
location_bar_(location_bar),
window_(gtk_window_new(GTK_WINDOW_POPUP)),
layout_(NULL),
theme_provider_(GtkThemeProvider::GetFrom(profile)),
ignore_mouse_drag_(false),
opened_(false) {
GTK_WIDGET_UNSET_FLAGS(window_, GTK_CAN_FOCUS);
gtk_window_set_resizable(GTK_WINDOW(window_), FALSE);
gtk_widget_set_app_paintable(window_, TRUE);
gtk_widget_set_double_buffered(window_, TRUE);
layout_ = gtk_widget_create_pango_layout(window_, NULL);
pango_layout_set_auto_dir(layout_, FALSE);
pango_layout_set_ellipsize(layout_, PANGO_ELLIPSIZE_END);
gfx::Font font = gfx::Font::CreateFont(
gfx::Font().FontName(), browser_defaults::kAutocompletePopupFontSize);
PangoFontDescription* pfd = gfx::Font::PangoFontFromGfxFont(font);
pango_layout_set_font_description(layout_, pfd);
pango_font_description_free(pfd);
gtk_widget_add_events(window_, GDK_BUTTON_MOTION_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK);
g_signal_connect(window_, "motion-notify-event",
G_CALLBACK(&HandleMotionThunk), this);
g_signal_connect(window_, "button-press-event",
G_CALLBACK(&HandleButtonPressThunk), this);
g_signal_connect(window_, "button-release-event",
G_CALLBACK(&HandleButtonReleaseThunk), this);
g_signal_connect(window_, "expose-event",
G_CALLBACK(&HandleExposeThunk), this);
registrar_.Add(this,
NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());
theme_provider_->InitThemesFor(this);
}
| 16,601 |
2,685 | 0 | grow_hunkmax (void)
{
hunkmax *= 2;
assert (p_line && p_len && p_Char);
if ((p_line = realloc (p_line, hunkmax * sizeof (*p_line)))
&& (p_len = realloc (p_len, hunkmax * sizeof (*p_len)))
&& (p_Char = realloc (p_Char, hunkmax * sizeof (*p_Char))))
return true;
if (!using_plan_a)
xalloc_die ();
/* Don't free previous values of p_line etc.,
since some broken implementations free them for us.
Whatever is null will be allocated again from within plan_a (),
of all places. */
return false;
}
| 16,602 |
34,706 | 0 | void br_netfilter_rtable_init(struct net_bridge *br)
{
struct rtable *rt = &br->fake_rtable;
atomic_set(&rt->dst.__refcnt, 1);
rt->dst.dev = br->dev;
rt->dst.path = &rt->dst;
dst_metric_set(&rt->dst, RTAX_MTU, 1500);
rt->dst.flags = DST_NOXFRM;
rt->dst.ops = &fake_dst_ops;
}
| 16,603 |
182,362 | 1 | av_cold void ff_mpv_idct_init(MpegEncContext *s)
{
ff_idctdsp_init(&s->idsp, s->avctx);
/* load & permutate scantables
* note: only wmv uses different ones
*/
if (s->alternate_scan) {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_alternate_vertical_scan);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_alternate_vertical_scan);
} else {
ff_init_scantable(s->idsp.idct_permutation, &s->inter_scantable, ff_zigzag_direct);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
}
ff_init_scantable(s->idsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
}
| 16,604 |
69,420 | 0 | cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
{
int i;
dst->revision = src->revision;
dst->num_subauth = min_t(u8, src->num_subauth, SID_MAX_SUB_AUTHORITIES);
for (i = 0; i < NUM_AUTHS; ++i)
dst->authority[i] = src->authority[i];
for (i = 0; i < dst->num_subauth; ++i)
dst->sub_auth[i] = src->sub_auth[i];
}
| 16,605 |
15,484 | 0 | http_loop (const struct url *u, struct url *original_url, char **newloc,
char **local_file, const char *referer, int *dt, struct url *proxy,
struct iri *iri)
{
int count;
bool got_head = false; /* used for time-stamping and filename detection */
bool time_came_from_head = false;
bool got_name = false;
char *tms;
const char *tmrate;
uerr_t err, ret = TRYLIMEXC;
time_t tmr = -1; /* remote time-stamp */
struct http_stat hstat; /* HTTP status */
struct stat st;
bool send_head_first = true;
bool force_full_retrieve = false;
/* If we are writing to a WARC file: always retrieve the whole file. */
if (opt.warc_filename != NULL)
force_full_retrieve = true;
/* Assert that no value for *LOCAL_FILE was passed. */
assert (local_file == NULL || *local_file == NULL);
/* Set LOCAL_FILE parameter. */
if (local_file && opt.output_document)
*local_file = HYPHENP (opt.output_document) ? NULL : xstrdup (opt.output_document);
/* Reset NEWLOC parameter. */
*newloc = NULL;
/* This used to be done in main, but it's a better idea to do it
here so that we don't go through the hoops if we're just using
FTP or whatever. */
if (opt.cookies)
load_cookies ();
/* Warn on (likely bogus) wildcard usage in HTTP. */
if (opt.ftp_glob && has_wildcards_p (u->path))
logputs (LOG_VERBOSE, _("Warning: wildcards not supported in HTTP.\n"));
/* Setup hstat struct. */
xzero (hstat);
hstat.referer = referer;
if (opt.output_document)
{
hstat.local_file = xstrdup (opt.output_document);
got_name = true;
}
else if (!opt.content_disposition)
{
hstat.local_file =
url_file_name (opt.trustservernames ? u : original_url, NULL);
got_name = true;
}
if (got_name && file_exists_p (hstat.local_file, NULL) && opt.noclobber && !opt.output_document)
{
/* If opt.noclobber is turned on and file already exists, do not
retrieve the file. But if the output_document was given, then this
test was already done and the file didn't exist. Hence the !opt.output_document */
get_file_flags (hstat.local_file, dt);
ret = RETROK;
goto exit;
}
/* Reset the counter. */
count = 0;
/* Reset the document type. */
*dt = 0;
/* Skip preliminary HEAD request if we're not in spider mode. */
if (!opt.spider)
send_head_first = false;
/* Send preliminary HEAD request if --content-disposition and -c are used
together. */
if (opt.content_disposition && opt.always_rest)
send_head_first = true;
#ifdef HAVE_METALINK
if (opt.metalink_over_http)
{
*dt |= METALINK_METADATA;
send_head_first = true;
}
#endif
if (opt.timestamping)
{
/* Use conditional get request if requested
* and if timestamp is known at this moment. */
if (opt.if_modified_since && !send_head_first && got_name && file_exists_p (hstat.local_file, NULL))
{
*dt |= IF_MODIFIED_SINCE;
{
uerr_t timestamp_err = set_file_timestamp (&hstat);
if (timestamp_err != RETROK)
return timestamp_err;
}
}
/* Send preliminary HEAD request if -N is given and we have existing
* destination file or content disposition is enabled. */
else if (opt.content_disposition || file_exists_p (hstat.local_file, NULL))
send_head_first = true;
}
/* THE loop */
do
{
/* Increment the pass counter. */
++count;
sleep_between_retrievals (count);
/* Get the current time string. */
tms = datetime_str (time (NULL));
if (opt.spider && !got_head)
logprintf (LOG_VERBOSE,
_("Spider mode enabled. Check if remote file exists.\n"));
/* Print fetch message, if opt.verbose. */
if (opt.verbose)
{
char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
if (count > 1)
{
char tmp[256];
sprintf (tmp, _("(try:%2d)"), count);
logprintf (LOG_NOTQUIET, "--%s-- %s %s\n",
tms, tmp, hurl);
}
else
{
logprintf (LOG_NOTQUIET, "--%s-- %s\n",
tms, hurl);
}
#ifdef WINDOWS
ws_changetitle (hurl);
#endif
xfree (hurl);
}
/* Default document type is empty. However, if spider mode is
on or time-stamping is employed, HEAD_ONLY commands is
encoded within *dt. */
if (send_head_first && !got_head)
*dt |= HEAD_ONLY;
else
*dt &= ~HEAD_ONLY;
/* Decide whether or not to restart. */
if (force_full_retrieve)
hstat.restval = hstat.len;
else if (opt.start_pos >= 0)
hstat.restval = opt.start_pos;
else if (opt.always_rest
&& got_name
&& stat (hstat.local_file, &st) == 0
&& S_ISREG (st.st_mode))
/* When -c is used, continue from on-disk size. (Can't use
hstat.len even if count>1 because we don't want a failed
first attempt to clobber existing data.) */
hstat.restval = st.st_size;
else if (count > 1)
/* otherwise, continue where the previous try left off */
hstat.restval = hstat.len;
else
hstat.restval = 0;
/* Decide whether to send the no-cache directive. We send it in
two cases:
a) we're using a proxy, and we're past our first retrieval.
Some proxies are notorious for caching incomplete data, so
we require a fresh get.
b) caching is explicitly inhibited. */
if ((proxy && count > 1) /* a */
|| !opt.allow_cache) /* b */
*dt |= SEND_NOCACHE;
else
*dt &= ~SEND_NOCACHE;
/* Try fetching the document, or at least its head. */
err = gethttp (u, original_url, &hstat, dt, proxy, iri, count);
/* Time? */
tms = datetime_str (time (NULL));
/* Get the new location (with or without the redirection). */
if (hstat.newloc)
*newloc = xstrdup (hstat.newloc);
switch (err)
{
case HERR: case HEOF: case CONSOCKERR:
case CONERROR: case READERR: case WRITEFAILED:
case RANGEERR: case FOPEN_EXCL_ERR: case GATEWAYTIMEOUT:
/* Non-fatal errors continue executing the loop, which will
bring them to "while" statement at the end, to judge
whether the number of tries was exceeded. */
printwhat (count, opt.ntry);
xfree (hstat.message);
xfree (hstat.error);
continue;
case FWRITEERR: case FOPENERR:
/* Another fatal error. */
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Cannot write to %s (%s).\n"),
quote (hstat.local_file), strerror (errno));
case HOSTERR: case CONIMPOSSIBLE: case PROXERR: case SSLINITFAILED:
case CONTNOTSUPPORTED: case VERIFCERTERR: case FILEBADFILE:
case UNKNOWNATTR:
/* Fatal errors just return from the function. */
ret = err;
goto exit;
case ATTRMISSING:
/* A missing attribute in a Header is a fatal Protocol error. */
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Required attribute missing from Header received.\n"));
ret = err;
goto exit;
case AUTHFAILED:
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Username/Password Authentication Failed.\n"));
ret = err;
goto exit;
case WARC_ERR:
/* A fatal WARC error. */
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Cannot write to WARC file.\n"));
ret = err;
goto exit;
case WARC_TMP_FOPENERR: case WARC_TMP_FWRITEERR:
/* A fatal WARC error. */
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Cannot write to temporary WARC file.\n"));
ret = err;
goto exit;
case CONSSLERR:
/* Another fatal error. */
logprintf (LOG_NOTQUIET, _("Unable to establish SSL connection.\n"));
ret = err;
goto exit;
case UNLINKERR:
/* Another fatal error. */
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("Cannot unlink %s (%s).\n"),
quote (hstat.local_file), strerror (errno));
ret = err;
goto exit;
case NEWLOCATION:
case NEWLOCATION_KEEP_POST:
/* Return the new location to the caller. */
if (!*newloc)
{
logprintf (LOG_NOTQUIET,
_("ERROR: Redirection (%d) without location.\n"),
hstat.statcode);
ret = WRONGCODE;
}
else
{
ret = err;
}
goto exit;
case RETRUNNEEDED:
/* The file was already fully retrieved. */
ret = RETROK;
goto exit;
case RETRFINISHED:
/* Deal with you later. */
break;
#ifdef HAVE_METALINK
case RETR_WITH_METALINK:
{
if (hstat.metalink == NULL)
{
logputs (LOG_NOTQUIET,
_("Could not find Metalink data in HTTP response. "
"Downloading file using HTTP GET.\n"));
*dt &= ~METALINK_METADATA;
*dt &= ~HEAD_ONLY;
got_head = true;
continue;
}
logputs (LOG_VERBOSE,
_("Metalink headers found. "
"Switching to Metalink mode.\n"));
ret = retrieve_from_metalink (hstat.metalink);
goto exit;
}
break;
#endif
default:
/* All possibilities should have been exhausted. */
abort ();
}
if (!(*dt & RETROKF))
{
char *hurl = NULL;
if (!opt.verbose)
{
/* #### Ugly ugly ugly! */
hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
logprintf (LOG_NONVERBOSE, "%s:\n", hurl);
}
/* Fall back to GET if HEAD fails with a 500 or 501 error code. */
if (*dt & HEAD_ONLY
&& (hstat.statcode == 500 || hstat.statcode == 501))
{
got_head = true;
continue;
}
/* Maybe we should always keep track of broken links, not just in
* spider mode.
* Don't log error if it was UTF-8 encoded because we will try
* once unencoded. */
else if (opt.spider && !iri->utf8_encode)
{
/* #### Again: ugly ugly ugly! */
if (!hurl)
hurl = url_string (u, URL_AUTH_HIDE_PASSWD);
nonexisting_url (hurl);
logprintf (LOG_NOTQUIET, _("\
Remote file does not exist -- broken link!!!\n"));
}
else if (check_retry_on_http_error (hstat.statcode))
{
printwhat (count, opt.ntry);
continue;
}
else
{
logprintf (LOG_NOTQUIET, _("%s ERROR %d: %s.\n"),
tms, hstat.statcode,
quotearg_style (escape_quoting_style, hstat.error));
}
logputs (LOG_VERBOSE, "\n");
ret = WRONGCODE;
xfree (hurl);
goto exit;
}
/* Did we get the time-stamp? */
if (!got_head || (opt.spider && !opt.recursive))
{
got_head = true; /* no more time-stamping */
if (opt.timestamping && !hstat.remote_time)
{
logputs (LOG_NOTQUIET, _("\
Last-modified header missing -- time-stamps turned off.\n"));
}
else if (hstat.remote_time)
{
/* Convert the date-string into struct tm. */
tmr = http_atotm (hstat.remote_time);
if (tmr == (time_t) (-1))
logputs (LOG_VERBOSE, _("\
Last-modified header invalid -- time-stamp ignored.\n"));
if (*dt & HEAD_ONLY)
time_came_from_head = true;
}
if (send_head_first)
{
/* The time-stamping section. */
if (opt.timestamping)
{
if (hstat.orig_file_name) /* Perform the following
checks only if the file
we're supposed to
download already exists. */
{
if (hstat.remote_time &&
tmr != (time_t) (-1))
{
/* Now time-stamping can be used validly.
Time-stamping means that if the sizes of
the local and remote file match, and local
file is newer than the remote file, it will
not be retrieved. Otherwise, the normal
download procedure is resumed. */
if (hstat.orig_file_tstamp >= tmr)
{
if (hstat.contlen == -1
|| hstat.orig_file_size == hstat.contlen)
{
logprintf (LOG_VERBOSE, _("\
Server file no newer than local file %s -- not retrieving.\n\n"),
quote (hstat.orig_file_name));
ret = RETROK;
goto exit;
}
else
{
logprintf (LOG_VERBOSE, _("\
The sizes do not match (local %s) -- retrieving.\n"),
number_to_static_string (hstat.orig_file_size));
}
}
else
{
force_full_retrieve = true;
logputs (LOG_VERBOSE,
_("Remote file is newer, retrieving.\n"));
}
logputs (LOG_VERBOSE, "\n");
}
}
/* free_hstat (&hstat); */
hstat.timestamp_checked = true;
}
if (opt.spider)
{
bool finished = true;
if (opt.recursive)
{
if ((*dt & TEXTHTML) || (*dt & TEXTCSS))
{
logputs (LOG_VERBOSE, _("\
Remote file exists and could contain links to other resources -- retrieving.\n\n"));
finished = false;
}
else
{
logprintf (LOG_VERBOSE, _("\
Remote file exists but does not contain any link -- not retrieving.\n\n"));
ret = RETROK; /* RETRUNNEEDED is not for caller. */
}
}
else
{
if ((*dt & TEXTHTML) || (*dt & TEXTCSS))
{
logprintf (LOG_VERBOSE, _("\
Remote file exists and could contain further links,\n\
but recursion is disabled -- not retrieving.\n\n"));
}
else
{
logprintf (LOG_VERBOSE, _("\
Remote file exists.\n\n"));
}
ret = RETROK; /* RETRUNNEEDED is not for caller. */
}
if (finished)
{
logprintf (LOG_NONVERBOSE,
_("%s URL: %s %2d %s\n"),
tms, u->url, hstat.statcode,
hstat.message ? quotearg_style (escape_quoting_style, hstat.message) : "");
goto exit;
}
}
got_name = true;
*dt &= ~HEAD_ONLY;
count = 0; /* the retrieve count for HEAD is reset */
xfree (hstat.message);
xfree (hstat.error);
continue;
} /* send_head_first */
} /* !got_head */
if (opt.useservertimestamps
&& (tmr != (time_t) (-1))
&& ((hstat.len == hstat.contlen) ||
((hstat.res == 0) && (hstat.contlen == -1))))
{
const char *fl = NULL;
set_local_file (&fl, hstat.local_file);
if (fl)
{
time_t newtmr = -1;
/* Reparse time header, in case it's changed. */
if (time_came_from_head
&& hstat.remote_time && hstat.remote_time[0])
{
newtmr = http_atotm (hstat.remote_time);
if (newtmr != (time_t)-1)
tmr = newtmr;
}
touch (fl, tmr);
}
}
/* End of time-stamping section. */
tmrate = retr_rate (hstat.rd_size, hstat.dltime);
total_download_time += hstat.dltime;
if (hstat.len == hstat.contlen)
{
if (*dt & RETROKF || opt.content_on_error)
{
bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
logprintf (LOG_VERBOSE,
write_to_stdout
? _("%s (%s) - written to stdout %s[%s/%s]\n\n")
: _("%s (%s) - %s saved [%s/%s]\n\n"),
tms, tmrate,
write_to_stdout ? "" : quote (hstat.local_file),
number_to_static_string (hstat.len),
number_to_static_string (hstat.contlen));
logprintf (LOG_NONVERBOSE,
"%s URL:%s [%s/%s] -> \"%s\" [%d]\n",
tms, u->url,
number_to_static_string (hstat.len),
number_to_static_string (hstat.contlen),
hstat.local_file, count);
}
++numurls;
total_downloaded_bytes += hstat.rd_size;
/* Remember that we downloaded the file for later ".orig" code. */
if (*dt & ADDED_HTML_EXTENSION)
downloaded_file (FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
else
downloaded_file (FILE_DOWNLOADED_NORMALLY, hstat.local_file);
ret = RETROK;
goto exit;
}
else if (hstat.res == 0) /* No read error */
{
if (hstat.contlen == -1) /* We don't know how much we were supposed
to get, so assume we succeeded. */
{
if (*dt & RETROKF || opt.content_on_error)
{
bool write_to_stdout = (opt.output_document && HYPHENP (opt.output_document));
logprintf (LOG_VERBOSE,
write_to_stdout
? _("%s (%s) - written to stdout %s[%s]\n\n")
: _("%s (%s) - %s saved [%s]\n\n"),
tms, tmrate,
write_to_stdout ? "" : quote (hstat.local_file),
number_to_static_string (hstat.len));
logprintf (LOG_NONVERBOSE,
"%s URL:%s [%s] -> \"%s\" [%d]\n",
tms, u->url, number_to_static_string (hstat.len),
hstat.local_file, count);
}
++numurls;
total_downloaded_bytes += hstat.rd_size;
/* Remember that we downloaded the file for later ".orig" code. */
if (*dt & ADDED_HTML_EXTENSION)
downloaded_file (FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, hstat.local_file);
else
downloaded_file (FILE_DOWNLOADED_NORMALLY, hstat.local_file);
ret = RETROK;
goto exit;
}
else if (hstat.len < hstat.contlen) /* meaning we lost the
connection too soon */
{
logprintf (LOG_VERBOSE,
_("%s (%s) - Connection closed at byte %s. "),
tms, tmrate, number_to_static_string (hstat.len));
printwhat (count, opt.ntry);
continue;
}
else if (hstat.len != hstat.restval)
/* Getting here would mean reading more data than
requested with content-length, which we never do. */
abort ();
else
{
/* Getting here probably means that the content-length was
* _less_ than the original, local size. We should probably
* truncate or re-read, or something. FIXME */
ret = RETROK;
goto exit;
}
}
else /* from now on hstat.res can only be -1 */
{
if (hstat.contlen == -1)
{
logprintf (LOG_VERBOSE,
_("%s (%s) - Read error at byte %s (%s)."),
tms, tmrate, number_to_static_string (hstat.len),
hstat.rderrmsg);
printwhat (count, opt.ntry);
continue;
}
else /* hstat.res == -1 and contlen is given */
{
logprintf (LOG_VERBOSE,
_("%s (%s) - Read error at byte %s/%s (%s). "),
tms, tmrate,
number_to_static_string (hstat.len),
number_to_static_string (hstat.contlen),
hstat.rderrmsg);
printwhat (count, opt.ntry);
continue;
}
}
/* not reached */
}
while (!opt.ntry || (count < opt.ntry));
exit:
if ((ret == RETROK || opt.content_on_error) && local_file)
{
xfree (*local_file);
/* Bugfix: Prevent SIGSEGV when hstat.local_file was left NULL
(i.e. due to opt.content_disposition). */
if (hstat.local_file)
*local_file = xstrdup (hstat.local_file);
}
free_hstat (&hstat);
return ret;
}
| 16,606 |
165,408 | 0 | StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcessIOThread() {
return url_loader_factory_getter_->GetNetworkFactoryInfo();
}
| 16,607 |
170,417 | 0 | SkRegion* android_graphics_Region_getSkRegion(JNIEnv* env, jobject regionObj) {
return GetSkRegion(env, regionObj);
}
| 16,608 |
6,770 | 0 | static void macio_ide_reset(DeviceState *dev)
{
MACIOIDEState *d = MACIO_IDE(dev);
ide_bus_reset(&d->bus);
}
| 16,609 |
187,583 | 1 | int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info,
ogg_int32_t **in,int *nonzero,int ch){
int i,j,k,s,used=0;
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
codebook *phrasebook=ci->book_param+info->groupbook;
int samples_per_partition=info->grouping;
int partitions_per_word=phrasebook->dim;
int pcmend=ci->blocksizes[vd->W];
if(info->type<2){
int max=pcmend>>1;
int end=(info->end<max?info->end:max);
int n=end-info->begin;
if(n>0){
int partvals=n/samples_per_partition;
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
for(i=0;i<ch;i++)
if(nonzero[i])
in[used++]=in[i];
ch=used;
if(used){
char **partword=(char **)alloca(ch*sizeof(*partword));
for(j=0;j<ch;j++)
partword[j]=(char *)alloca(partwords*partitions_per_word*
sizeof(*partword[j]));
for(s=0;s<info->stages;s++){
for(i=0;i<partvals;){
if(s==0){
/* fetch the partition word for each channel *
partword[0][i+partitions_per_word-1]=1;
for(k=partitions_per_word-2;k>=0;k--)
partword[0][i+k]=partword[0][i+k+1]*info->partitions;
for(j=1;j<ch;j++)
for(k=partitions_per_word-1;k>=0;k--)
partword[j][i+k]=partword[j-1][i+k];
for(j=0;j<ch;j++){
int temp=vorbis_book_decode(phrasebook,&vd->opb);
if(temp==-1)goto eopbreak;
/* this can be done quickly in assembly due to the quotient
always being at most six bits *
for(k=0;k<partitions_per_word;k++){
ogg_uint32_t div=partword[j][i+k];
partword[j][i+k]=temp/div;
temp-=partword[j][i+k]*div;
}
}
}
/* now we decode residual values for the partitions *
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
for(j=0;j<ch;j++){
long offset=info->begin+i*samples_per_partition;
if(info->stagemasks[(int)partword[j][i]]&(1<<s)){
codebook *stagebook=ci->book_param+
info->stagebooks[(partword[j][i]<<3)+s];
if(info->type){
if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb,
samples_per_partition,-8)==-1)
goto eopbreak;
}else{
if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb,
samples_per_partition,-8)==-1)
goto eopbreak;
}
}
}
}
}
}
}
}else{
int max=(pcmend*ch)>>1;
int end=(info->end<max?info->end:max);
int n=end-info->begin;
if(n>0){
int partvals=n/samples_per_partition;
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
char *partword=
(char *)alloca(partwords*partitions_per_word*sizeof(*partword));
int beginoff=info->begin/ch;
for(i=0;i<ch;i++)if(nonzero[i])break;
if(i==ch)return(0); /* no nonzero vectors */
samples_per_partition/=ch;
for(s=0;s<info->stages;s++){
for(i=0;i<partvals;){
if(s==0){
int temp;
partword[i+partitions_per_word-1]=1;
for(k=partitions_per_word-2;k>=0;k--)
partword[i+k]=partword[i+k+1]*info->partitions;
/* fetch the partition word */
temp=vorbis_book_decode(phrasebook,&vd->opb);
if(temp==-1)goto eopbreak;
/* this can be done quickly in assembly due to the quotient
always being at most six bits */
for(k=0;k<partitions_per_word;k++){
ogg_uint32_t div=partword[i+k];
partword[i+k]=temp/div;
temp-=partword[i+k]*div;
}
}
/* now we decode residual values for the partitions */
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
if(info->stagemasks[(int)partword[i]]&(1<<s)){
codebook *stagebook=ci->book_param+
info->stagebooks[(partword[i]<<3)+s];
if(vorbis_book_decodevv_add(stagebook,in,
i*samples_per_partition+beginoff,ch,
&vd->opb,
samples_per_partition,-8)==-1)
goto eopbreak;
}
}
}
}
}
eopbreak:
return 0;
}
| 16,610 |
82,981 | 0 | static inline int flexarray_get_bin_size(struct flexarray *flex, int bin)
{
(void)flex;
if (bin >= ARRAY_SIZE(bin_offset))
return -1;
int next = bin_offset[bin + 1];
return next - bin_offset[bin];
}
| 16,611 |
13,153 | 0 | xps_parse_render_transform(xps_document *doc, char *transform, fz_matrix *matrix)
{
float args[6];
char *s = transform;
int i;
args[0] = 1; args[1] = 0;
args[2] = 0; args[3] = 1;
args[4] = 0; args[5] = 0;
for (i = 0; i < 6 && *s; i++)
{
args[i] = fz_atof(s);
while (*s && *s != ',')
s++;
if (*s == ',')
s++;
}
matrix->a = args[0]; matrix->b = args[1];
matrix->c = args[2]; matrix->d = args[3];
matrix->e = args[4]; matrix->f = args[5];
}
| 16,612 |
171,461 | 0 | static vpx_codec_err_t update_error_state(vpx_codec_alg_priv_t *ctx,
const struct vpx_internal_error_info *error) {
if (error->error_code)
set_error_detail(ctx, error->has_detail ? error->detail : NULL);
return error->error_code;
}
| 16,613 |
12,942 | 0 | static void print_msg(struct nl_msg *msg, FILE *ofd, struct nlmsghdr *hdr)
{
struct nl_cache_ops *ops;
int payloadlen = nlmsg_len(hdr);
int attrlen = 0;
void *data;
data = nlmsg_data(hdr);
ops = nl_cache_ops_associate_safe(nlmsg_get_proto(msg),
hdr->nlmsg_type);
if (ops) {
attrlen = nlmsg_attrlen(hdr, ops->co_hdrsize);
payloadlen -= attrlen;
}
if (msg->nm_protocol == NETLINK_GENERIC)
data = print_genl_msg(msg, ofd, hdr, ops, &payloadlen);
if (payloadlen) {
fprintf(ofd, " [PAYLOAD] %d octets\n", payloadlen);
dump_hex(ofd, data, payloadlen, 0);
}
if (attrlen) {
struct nlattr *attrs;
int attrlen;
attrs = nlmsg_attrdata(hdr, ops->co_hdrsize);
attrlen = nlmsg_attrlen(hdr, ops->co_hdrsize);
dump_attrs(ofd, attrs, attrlen, 0);
}
if (ops)
nl_cache_ops_put(ops);
}
| 16,614 |
181,591 | 1 | static void detect_allow_debuggers(int argc, char **argv) {
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--allow-debuggers") == 0) {
arg_allow_debuggers = 1;
break;
}
if (strcmp(argv[i], "--") == 0)
break;
if (strncmp(argv[i], "--", 2) != 0)
break;
}
}
| 16,615 |
58,816 | 0 | int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
{
return -ENOSYS;
}
| 16,616 |
106,899 | 0 | IntRect RenderBox::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, IntPoint* cachedOffsetToRepaintContainer) const
{
IntRect box = borderBoundingBox();
adjustRectForOutlineAndShadow(box);
FloatQuad containerRelativeQuad = FloatRect(box);
if (cachedOffsetToRepaintContainer)
containerRelativeQuad.move(cachedOffsetToRepaintContainer->x(), cachedOffsetToRepaintContainer->y());
else
containerRelativeQuad = localToContainerQuad(containerRelativeQuad, repaintContainer);
box = containerRelativeQuad.enclosingBoundingBox();
box.move(view()->layoutDelta());
return box;
}
| 16,617 |
73,594 | 0 | static void InsertRow(unsigned char *p,ssize_t y,Image *image, int bpp)
{
ExceptionInfo
*exception;
int
bit;
ssize_t
x;
register PixelPacket
*q;
IndexPacket
index;
register IndexPacket
*indexes;
exception=(&image->exception);
switch (bpp)
{
case 1: /* Convert bitmap scanline. */
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < ((ssize_t) image->columns-7); x+=8)
{
for (bit=0; bit < 8; bit++)
{
index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
SetPixelIndex(indexes+x+bit,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
}
p++;
}
if ((image->columns % 8) != 0)
{
for (bit=0; bit < (ssize_t) (image->columns % 8); bit++)
{
index=((*p) & (0x80 >> bit) ? 0x01 : 0x00);
SetPixelIndex(indexes+x+bit,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
}
p++;
}
if (!SyncAuthenticPixels(image,exception))
break;
break;
}
case 2: /* Convert PseudoColor scanline. */
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < ((ssize_t) image->columns-1); x+=4)
{
index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
index=ConstrainColormapIndex(image,(*p) & 0x3);
SetPixelIndex(indexes+x+1,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
if ((image->columns % 4) != 0)
{
index=ConstrainColormapIndex(image,(*p >> 6) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
if ((image->columns % 4) >= 1)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
if ((image->columns % 4) >= 2)
{
index=ConstrainColormapIndex(image,(*p >> 2) & 0x3);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
}
}
p++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
break;
}
case 4: /* Convert PseudoColor scanline. */
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < ((ssize_t) image->columns-1); x+=2)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
q++;
index=ConstrainColormapIndex(image,(*p) & 0x0f);
SetPixelIndex(indexes+x+1,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
if ((image->columns % 2) != 0)
{
index=ConstrainColormapIndex(image,(*p >> 4) & 0x0f);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
break;
}
case 8: /* Convert PseudoColor scanline. */
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL) break;
indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
index=ConstrainColormapIndex(image,*p);
SetPixelIndex(indexes+x,index);
SetPixelRGBO(q,image->colormap+(ssize_t) index);
p++;
q++;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
break;
case 24: /* Convert DirectColor scanline. */
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(q,ScaleCharToQuantum(*p++));
SetPixelGreen(q,ScaleCharToQuantum(*p++));
SetPixelBlue(q,ScaleCharToQuantum(*p++));
q++;
}
if (!SyncAuthenticPixels(image,exception))
break;
break;
}
}
| 16,618 |
79,267 | 0 | TmEcode StreamTcpThreadDeinit(ThreadVars *tv, void *data)
{
SCEnter();
StreamTcpThread *stt = (StreamTcpThread *)data;
if (stt == NULL) {
return TM_ECODE_OK;
}
/* XXX */
/* free reassembly ctx */
StreamTcpReassembleFreeThreadCtx(stt->ra_ctx);
/* clear memory */
memset(stt, 0, sizeof(StreamTcpThread));
SCFree(stt);
SCReturnInt(TM_ECODE_OK);
}
| 16,619 |
140,642 | 0 | void OutOfProcessInstance::PreviewDocumentLoadFailed() {
UserMetricsRecordAction("PDF.PreviewDocumentLoadFailure");
if (preview_document_load_state_ != LOAD_STATE_LOADING ||
preview_pages_info_.empty()) {
return;
}
preview_document_load_state_ = LOAD_STATE_FAILED;
preview_pages_info_.pop();
if (!preview_pages_info_.empty())
LoadAvailablePreviewPage();
}
| 16,620 |
85,739 | 0 | static ssize_t o2nm_cluster_attr_write(const char *page, ssize_t count,
unsigned int *val)
{
unsigned long tmp;
char *p = (char *)page;
tmp = simple_strtoul(p, &p, 0);
if (!p || (*p && (*p != '\n')))
return -EINVAL;
if (tmp == 0)
return -EINVAL;
if (tmp >= (u32)-1)
return -ERANGE;
*val = tmp;
return count;
}
| 16,621 |
168,941 | 0 | DevToolsSession* DevToolsAgentHostImpl::SessionByClient(
DevToolsAgentHostClient* client) {
auto it = session_by_client_.find(client);
return it == session_by_client_.end() ? nullptr : it->second.get();
}
| 16,622 |
15,725 | 0 | static void put_uint32(QEMUFile *f, void *pv, size_t size)
{
uint32_t *v = pv;
qemu_put_be32s(f, v);
}
| 16,623 |
25,563 | 0 | void __init trap_init(void)
{
set_exception_table_vec(TRAP_RESERVED_INST, do_reserved_inst);
set_exception_table_vec(TRAP_ILLEGAL_SLOT_INST, do_illegal_slot_inst);
#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_FPU) || \
defined(CONFIG_SH_FPU_EMU)
/*
* For SH-4 lacking an FPU, treat floating point instructions as
* reserved. They'll be handled in the math-emu case, or faulted on
* otherwise.
*/
set_exception_table_evt(0x800, do_reserved_inst);
set_exception_table_evt(0x820, do_illegal_slot_inst);
#elif defined(CONFIG_SH_FPU)
set_exception_table_evt(0x800, fpu_state_restore_trap_handler);
set_exception_table_evt(0x820, fpu_state_restore_trap_handler);
#endif
#ifdef CONFIG_CPU_SH2
set_exception_table_vec(TRAP_ADDRESS_ERROR, address_error_trap_handler);
#endif
#ifdef CONFIG_CPU_SH2A
set_exception_table_vec(TRAP_DIVZERO_ERROR, do_divide_error);
set_exception_table_vec(TRAP_DIVOVF_ERROR, do_divide_error);
#ifdef CONFIG_SH_FPU
set_exception_table_vec(TRAP_FPU_ERROR, fpu_error_trap_handler);
#endif
#endif
#ifdef TRAP_UBC
set_exception_table_vec(TRAP_UBC, breakpoint_trap_handler);
#endif
}
| 16,624 |
105,496 | 0 | static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*)
{
return FALSE;
}
| 16,625 |
59,323 | 0 | static int attach_aead(struct xfrm_state *x, struct nlattr *rta)
{
struct xfrm_algo_aead *p, *ualg;
struct xfrm_algo_desc *algo;
if (!rta)
return 0;
ualg = nla_data(rta);
algo = xfrm_aead_get_byname(ualg->alg_name, ualg->alg_icv_len, 1);
if (!algo)
return -ENOSYS;
x->props.ealgo = algo->desc.sadb_alg_id;
p = kmemdup(ualg, aead_len(ualg), GFP_KERNEL);
if (!p)
return -ENOMEM;
strcpy(p->alg_name, algo->name);
x->aead = p;
x->geniv = algo->uinfo.aead.geniv;
return 0;
}
| 16,626 |
59,076 | 0 | comics_document_get_n_pages (EvDocument *document)
{
ComicsDocument *comics_document = COMICS_DOCUMENT (document);
if (comics_document->page_names == NULL)
return 0;
return comics_document->page_names->len;
}
| 16,627 |
59,521 | 0 | xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
const xmlChar *ptr;
xmlChar cur;
xmlChar *name;
xmlEntityPtr entity = NULL;
if ((str == NULL) || (*str == NULL)) return(NULL);
ptr = *str;
cur = *ptr;
if (cur != '%')
return(NULL);
ptr++;
name = xmlParseStringName(ctxt, &ptr);
if (name == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"xmlParseStringPEReference: no name\n");
*str = ptr;
return(NULL);
}
cur = *ptr;
if (cur != ';') {
xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL);
xmlFree(name);
*str = ptr;
return(NULL);
}
ptr++;
/*
* Increate the number of entity references parsed
*/
ctxt->nbentities++;
/*
* Request the entity from SAX
*/
if ((ctxt->sax != NULL) &&
(ctxt->sax->getParameterEntity != NULL))
entity = ctxt->sax->getParameterEntity(ctxt->userData, name);
if (ctxt->instate == XML_PARSER_EOF) {
xmlFree(name);
*str = ptr;
return(NULL);
}
if (entity == NULL) {
/*
* [ WFC: Entity Declared ]
* In a document without any DTD, a document with only an
* internal DTD subset which contains no parameter entity
* references, or a document with "standalone='yes'", ...
* ... The declaration of a parameter entity must precede
* any reference to it...
*/
if ((ctxt->standalone == 1) ||
((ctxt->hasExternalSubset == 0) && (ctxt->hasPErefs == 0))) {
xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
"PEReference: %%%s; not found\n", name);
} else {
/*
* [ VC: Entity Declared ]
* In a document with an external subset or external
* parameter entities with "standalone='no'", ...
* ... The declaration of a parameter entity must
* precede any reference to it...
*/
xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
"PEReference: %%%s; not found\n",
name, NULL);
ctxt->valid = 0;
}
xmlParserEntityCheck(ctxt, 0, NULL, 0);
} else {
/*
* Internal checking in case the entity quest barfed
*/
if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) &&
(entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) {
xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY,
"%%%s; is not a parameter entity\n",
name, NULL);
}
}
ctxt->hasPErefs = 1;
xmlFree(name);
*str = ptr;
return(entity);
}
| 16,628 |
128,808 | 0 | bool GLSurface::InitializeOneOffInternal() {
switch (GetGLImplementation()) {
case kGLImplementationEGLGLES2:
if (!GLSurfaceEGL::InitializeOneOff()) {
LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
return false;
}
return true;
case kGLImplementationOSMesaGL:
case kGLImplementationMockGL:
return true;
default:
return false;
}
}
| 16,629 |
150,709 | 0 | PageInfoUI::ChosenObjectInfo::~ChosenObjectInfo() {}
| 16,630 |
161,946 | 0 | void PrintRenderFrameHelper::PrintHeaderAndFooter(
blink::WebCanvas* canvas,
int page_number,
int total_pages,
const blink::WebLocalFrame& source_frame,
float webkit_scale_factor,
const PageSizeMargins& page_layout,
const PrintMsg_Print_Params& params) {
cc::PaintCanvasAutoRestore auto_restore(canvas, true);
canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor);
blink::WebSize page_size(page_layout.margin_left + page_layout.margin_right +
page_layout.content_width,
page_layout.margin_top + page_layout.margin_bottom +
page_layout.content_height);
blink::WebView* web_view = blink::WebView::Create(
/* client = */ nullptr, blink::mojom::PageVisibilityState::kVisible,
/* opener = */ nullptr);
web_view->GetSettings()->SetJavaScriptEnabled(true);
class HeaderAndFooterClient final : public blink::WebFrameClient {
public:
void BindToFrame(blink::WebLocalFrame* frame) override { frame_ = frame; }
void FrameDetached(DetachType detach_type) override {
frame_->FrameWidget()->Close();
frame_->Close();
frame_ = nullptr;
}
private:
blink::WebLocalFrame* frame_;
};
HeaderAndFooterClient frame_client;
blink::WebLocalFrame* frame = blink::WebLocalFrame::CreateMainFrame(
web_view, &frame_client, nullptr, nullptr);
blink::WebWidgetClient web_widget_client;
blink::WebFrameWidget::Create(&web_widget_client, frame);
base::Value html(base::UTF8ToUTF16(
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PRINT_PREVIEW_PAGE)));
ExecuteScript(frame, kPageLoadScriptFormat, html);
auto options = base::MakeUnique<base::DictionaryValue>();
options->SetDouble(kSettingHeaderFooterDate, base::Time::Now().ToJsTime());
options->SetDouble("width", page_size.width);
options->SetDouble("height", page_size.height);
options->SetDouble("topMargin", page_layout.margin_top);
options->SetDouble("bottomMargin", page_layout.margin_bottom);
options->SetInteger("pageNumber", page_number);
options->SetInteger("totalPages", total_pages);
options->SetString("url", params.url);
base::string16 title = source_frame.GetDocument().Title().Utf16();
options->SetString("title", title.empty() ? params.title : title);
options->SetString("headerTemplate", params.header_template);
options->SetString("footerTemplate", params.footer_template);
ExecuteScript(frame, kPageSetupScriptFormat, *options);
blink::WebPrintParams webkit_params(page_size);
webkit_params.printer_dpi = GetDPI(¶ms);
frame->PrintBegin(webkit_params);
frame->PrintPage(0, canvas);
frame->PrintEnd();
web_view->Close();
}
| 16,631 |
33,579 | 0 | void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh))
{
mutex_lock(&sock_diag_table_mutex);
inet_rcv_compat = NULL;
mutex_unlock(&sock_diag_table_mutex);
}
| 16,632 |
125,529 | 0 | void GDataDirectoryService::SerializeToString(
std::string* serialized_proto) const {
GDataRootDirectoryProto proto;
root_->ToProto(proto.mutable_gdata_directory());
proto.set_largest_changestamp(largest_changestamp_);
proto.set_version(kProtoVersion);
const bool ok = proto.SerializeToString(serialized_proto);
DCHECK(ok);
}
| 16,633 |
99,983 | 0 | WebPluginResourceClient* WebPluginImpl::GetClientFromLoader(
WebURLLoader* loader) {
ClientInfo* client_info = GetClientInfoFromLoader(loader);
if (client_info)
return client_info->client;
return NULL;
}
| 16,634 |
36,628 | 0 | bool stratum_send(struct pool *pool, char *s, ssize_t len)
{
enum send_ret ret = SEND_INACTIVE;
if (opt_protocol)
applog(LOG_DEBUG, "SEND: %s", s);
mutex_lock(&pool->stratum_lock);
if (pool->stratum_active)
ret = __stratum_send(pool, s, len);
mutex_unlock(&pool->stratum_lock);
/* This is to avoid doing applog under stratum_lock */
switch (ret) {
default:
case SEND_OK:
break;
case SEND_SELECTFAIL:
applog(LOG_DEBUG, "Write select failed on %s sock", get_pool_name(pool));
suspend_stratum(pool);
break;
case SEND_SENDFAIL:
applog(LOG_DEBUG, "Failed to send in stratum_send");
suspend_stratum(pool);
break;
case SEND_INACTIVE:
applog(LOG_DEBUG, "Stratum send failed due to no pool stratum_active");
break;
}
return (ret == SEND_OK);
}
| 16,635 |
60,470 | 0 | R_API bool r_flag_exist_at(RFlag *f, const char *flag_prefix, ut16 fp_size, ut64 off) {
RListIter *iter = NULL;
RFlagItem *item = NULL;
if (!f) {
return false;
}
const RList *list = r_flag_get_list (f, off);
if (!list) {
return false;
}
r_list_foreach (list, iter, item) {
if (item->name && !strncmp (item->name, flag_prefix, fp_size)) {
return true;
}
}
return false;
}
| 16,636 |
21,295 | 0 | static inline int check_pgd_range(struct vm_area_struct *vma,
unsigned long addr, unsigned long end,
const nodemask_t *nodes, unsigned long flags,
void *private)
{
pgd_t *pgd;
unsigned long next;
pgd = pgd_offset(vma->vm_mm, addr);
do {
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd))
continue;
if (check_pud_range(vma, pgd, addr, next, nodes,
flags, private))
return -EIO;
} while (pgd++, addr = next, addr != end);
return 0;
}
| 16,637 |
52,634 | 0 | ppp_input_error(struct ppp_channel *chan, int code)
{
struct channel *pch = chan->ppp;
struct sk_buff *skb;
if (!pch)
return;
read_lock_bh(&pch->upl);
if (pch->ppp) {
skb = alloc_skb(0, GFP_ATOMIC);
if (skb) {
skb->len = 0; /* probably unnecessary */
skb->cb[0] = code;
ppp_do_recv(pch->ppp, skb, pch);
}
}
read_unlock_bh(&pch->upl);
}
| 16,638 |
161,986 | 0 | PdfCompositorServiceTest() : ServiceTest("pdf_compositor_service_unittest") {}
| 16,639 |
86,460 | 0 | static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx,
struct vm_area_struct *vma,
unsigned long address,
unsigned long flags,
unsigned long reason)
{
struct mm_struct *mm = ctx->mm;
pte_t *pte;
bool ret = true;
VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
pte = huge_pte_offset(mm, address, vma_mmu_pagesize(vma));
if (!pte)
goto out;
ret = false;
/*
* Lockless access: we're in a wait_event so it's ok if it
* changes under us.
*/
if (huge_pte_none(*pte))
ret = true;
if (!huge_pte_write(*pte) && (reason & VM_UFFD_WP))
ret = true;
out:
return ret;
}
| 16,640 |
139,612 | 0 | bool IsDolbyVisionHEVCCodecId(const std::string& codec_id) {
return base::StartsWith(codec_id, "dvh1.", base::CompareCase::SENSITIVE) ||
base::StartsWith(codec_id, "dvhe.", base::CompareCase::SENSITIVE);
}
| 16,641 |
36,996 | 0 | static __init int cpu_has_kvm_support(void)
{
return cpu_has_vmx();
}
| 16,642 |
39,235 | 0 | PHP_MSHUTDOWN_FUNCTION(gd)
{
T1_CloseLib();
#if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE
gdFontCacheMutexShutdown();
#endif
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
| 16,643 |
46,269 | 0 | static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
{
struct block_device *bdev = I_BDEV(file->f_mapping->host);
fmode_t mode = file->f_mode;
/*
* O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have
* to updated it before every ioctl.
*/
if (file->f_flags & O_NDELAY)
mode |= FMODE_NDELAY;
else
mode &= ~FMODE_NDELAY;
return blkdev_ioctl(bdev, mode, cmd, arg);
}
| 16,644 |
143,799 | 0 | const FilePath& GlobalHistogramAllocator::GetPersistentLocation() const {
return persistent_location_;
}
| 16,645 |
173,961 | 0 | long Cluster::GetNext(const BlockEntry* pCurr, const BlockEntry*& pNext) const {
assert(pCurr);
assert(m_entries);
assert(m_entries_count > 0);
size_t idx = pCurr->GetIndex();
assert(idx < size_t(m_entries_count));
assert(m_entries[idx] == pCurr);
++idx;
if (idx >= size_t(m_entries_count)) {
long long pos;
long len;
const long status = Parse(pos, len);
if (status < 0) { // error
pNext = NULL;
return status;
}
if (status > 0) {
pNext = NULL;
return 0;
}
assert(m_entries);
assert(m_entries_count > 0);
assert(idx < size_t(m_entries_count));
}
pNext = m_entries[idx];
assert(pNext);
return 0;
}
| 16,646 |
64,110 | 0 | static int snd_msnd_calibrate_adc(struct snd_msnd *chip, u16 srate)
{
snd_printdd("snd_msnd_calibrate_adc(%i)\n", srate);
writew(srate, chip->SMA + SMA_wCalFreqAtoD);
if (chip->calibrate_signal == 0)
writew(readw(chip->SMA + SMA_wCurrHostStatusFlags)
| 0x0001, chip->SMA + SMA_wCurrHostStatusFlags);
else
writew(readw(chip->SMA + SMA_wCurrHostStatusFlags)
& ~0x0001, chip->SMA + SMA_wCurrHostStatusFlags);
if (snd_msnd_send_word(chip, 0, 0, HDEXAR_CAL_A_TO_D) == 0 &&
snd_msnd_send_dsp_cmd_chk(chip, HDEX_AUX_REQ) == 0) {
schedule_timeout_interruptible(msecs_to_jiffies(333));
return 0;
}
printk(KERN_WARNING LOGNAME ": ADC calibration failed\n");
return -EIO;
}
| 16,647 |
37,486 | 0 | void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask)
{
shadow_mmio_mask = mmio_mask;
}
| 16,648 |
59,924 | 0 | get_alias_quirk(struct usb_device *dev, unsigned int id)
{
const struct usb_device_id *p;
for (p = usb_audio_ids; p->match_flags; p++) {
/* FIXME: this checks only vendor:product pair in the list */
if ((p->match_flags & USB_DEVICE_ID_MATCH_DEVICE) ==
USB_DEVICE_ID_MATCH_DEVICE &&
p->idVendor == USB_ID_VENDOR(id) &&
p->idProduct == USB_ID_PRODUCT(id))
return (const struct snd_usb_audio_quirk *)p->driver_info;
}
return NULL;
}
| 16,649 |
97,895 | 0 | void RenderView::DidStopLoadingForPlugin() {
didStopLoading();
}
| 16,650 |
45,504 | 0 | int crypto_unregister_alg(struct crypto_alg *alg)
{
int ret;
LIST_HEAD(list);
down_write(&crypto_alg_sem);
ret = crypto_remove_alg(alg, &list);
up_write(&crypto_alg_sem);
if (ret)
return ret;
BUG_ON(atomic_read(&alg->cra_refcnt) != 1);
if (alg->cra_destroy)
alg->cra_destroy(alg);
crypto_remove_final(&list);
return 0;
}
| 16,651 |
104,504 | 0 | void CrosMock::InitMockSpeechSynthesisLibrary() {
InitMockLibraryLoader();
if (mock_speech_synthesis_library_)
return;
mock_speech_synthesis_library_ =
new StrictMock<MockSpeechSynthesisLibrary>();
test_api()->SetSpeechSynthesisLibrary(mock_speech_synthesis_library_, true);
}
| 16,652 |
187,667 | 1 | image_transform_png_set_scale_16_add(image_transform *this,
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
{
UNUSED(colour_type)
this->next = *that;
*that = this;
return bit_depth > 8;
}
| 16,653 |
89,352 | 0 | static int parse_sliteral(char **c, char **dst)
{
struct token t;
char *s = *c;
get_token(c, &t, L_SLITERAL);
if (t.type != T_STRING) {
printf("Expected string literal: %.*s\n", (int)(*c - s), s);
return -EINVAL;
}
*dst = t.val;
return 1;
}
| 16,654 |
24,693 | 0 | static int process_cpu_timer_create(struct k_itimer *timer)
{
timer->it_clock = PROCESS_CLOCK;
return posix_cpu_timer_create(timer);
}
| 16,655 |
134,343 | 0 | gfx::ImageSkia* TabStrip::GetDropArrowImage(bool is_down) {
return ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
is_down ? IDR_TAB_DROP_DOWN : IDR_TAB_DROP_UP);
}
| 16,656 |
33,063 | 0 | static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval,
unsigned int optlen)
{
struct sctp_prim prim;
struct sctp_transport *trans;
if (optlen != sizeof(struct sctp_prim))
return -EINVAL;
if (copy_from_user(&prim, optval, sizeof(struct sctp_prim)))
return -EFAULT;
trans = sctp_addr_id2transport(sk, &prim.ssp_addr, prim.ssp_assoc_id);
if (!trans)
return -EINVAL;
sctp_assoc_set_primary(trans->asoc, trans);
return 0;
}
| 16,657 |
87,346 | 0 | vips_foreign_load_gif_error( VipsForeignLoadGif *gif )
{
int error;
error = 0;
#ifdef HAVE_GIFLIB_5
if( gif->file )
error = gif->file->Error;
#else
error = GifLastError();
#endif
if( error )
vips_foreign_load_gif_error_vips( gif, error );
}
| 16,658 |
151,892 | 0 | RenderFrameHostImpl::BuildNavigationClientCommitNavigationCallback(
NavigationRequest* navigation_request) {
DCHECK(navigation_request);
return base::BindOnce(
&RenderFrameHostImpl::DidCommitPerNavigationMojoInterfaceNavigation,
base::Unretained(this), navigation_request);
}
| 16,659 |
182,438 | 1 | static int ssl_parse_server_key_exchange( mbedtls_ssl_context *ssl )
{
int ret;
const mbedtls_ssl_ciphersuite_t *ciphersuite_info =
ssl->transform_negotiate->ciphersuite_info;
unsigned char *p = NULL, *end = NULL;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server key exchange" ) );
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA )
{
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse server key exchange" ) );
ssl->state++;
return( 0 );
}
((void) p);
((void) end);
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_RSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA )
{
if( ( ret = ssl_get_ecdh_params_from_cert( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "ssl_get_ecdh_params_from_cert", ret );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
return( ret );
}
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse server key exchange" ) );
ssl->state++;
return( 0 );
}
((void) p);
((void) end);
#endif /* MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED */
if( ( ret = mbedtls_ssl_read_record( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_read_record", ret );
return( ret );
}
if( ssl->in_msgtype != MBEDTLS_SSL_MSG_HANDSHAKE )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
/*
* ServerKeyExchange may be skipped with PSK and RSA-PSK when the server
* doesn't use a psk_identity_hint
*/
if( ssl->in_msg[0] != MBEDTLS_SSL_HS_SERVER_KEY_EXCHANGE )
{
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )
{
/* Current message is probably either
* CertificateRequest or ServerHelloDone */
ssl->keep_current_message = 1;
goto exit;
}
MBEDTLS_SSL_DEBUG_MSG( 1, ( "server key exchange message must "
"not be skipped" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_UNEXPECTED_MESSAGE );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );
end = ssl->in_msg + ssl->in_hslen;
MBEDTLS_SSL_DEBUG_BUF( 3, "server key exchange", p, end - p );
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK )
{
if( ssl_parse_server_psk_hint( ssl, &p, end ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
} /* FALLTROUGH */
#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_RSA_PSK )
; /* nothing more to do */
else
#endif /* MBEDTLS_KEY_EXCHANGE_PSK_ENABLED ||
MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_RSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_DHE_PSK )
{
if( ssl_parse_server_dh_params( ssl, &p, end ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_RSA ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_PSK ||
ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA )
{
if( ssl_parse_server_ecdh_params( ssl, &p, end ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ||
MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
if( ciphersuite_info->key_exchange == MBEDTLS_KEY_EXCHANGE_ECJPAKE )
{
ret = mbedtls_ecjpake_read_round_two( &ssl->handshake->ecjpake_ctx,
p, end - p );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ecjpake_read_round_two", ret );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
}
else
#endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
#if defined(MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED)
if( mbedtls_ssl_ciphersuite_uses_server_signature( ciphersuite_info ) )
{
size_t sig_len, hashlen;
unsigned char hash[64];
mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;
mbedtls_pk_type_t pk_alg = MBEDTLS_PK_NONE;
unsigned char *params = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl );
size_t params_len = p - params;
/*
* Handle the digitally-signed structure
*/
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
if( ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_3 )
{
if( ssl_parse_signature_algorithm( ssl, &p, end,
&md_alg, &pk_alg ) != 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
if( pk_alg != mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
}
else
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
if( ssl->minor_ver < MBEDTLS_SSL_MINOR_VERSION_3 )
{
pk_alg = mbedtls_ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );
/* Default hash for ECDSA is SHA-1 */
if( pk_alg == MBEDTLS_PK_ECDSA && md_alg == MBEDTLS_MD_NONE )
md_alg = MBEDTLS_MD_SHA1;
}
else
#endif
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
/*
* Read signature
*/
sig_len = ( p[0] << 8 ) | p[1];
p += 2;
if( end != p + sig_len )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
}
MBEDTLS_SSL_DEBUG_BUF( 3, "signature", p, sig_len );
/*
* Compute the hash that has been signed
*/
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1)
if( md_alg == MBEDTLS_MD_NONE )
{
hashlen = 36;
ret = mbedtls_ssl_get_key_exchange_md_ssl_tls( ssl, hash, params,
params_len );
if( ret != 0 )
return( ret );
}
else
#endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \
MBEDTLS_SSL_PROTO_TLS1_1 */
#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_2)
if( md_alg != MBEDTLS_MD_NONE )
{
/* Info from md_alg will be used instead */
hashlen = 0;
ret = mbedtls_ssl_get_key_exchange_md_tls1_2( ssl, hash, params,
params_len, md_alg );
if( ret != 0 )
return( ret );
}
else
#endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \
MBEDTLS_SSL_PROTO_TLS1_2 */
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "should never happen" ) );
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
}
MBEDTLS_SSL_DEBUG_BUF( 3, "parameters hash", hash, hashlen != 0 ? hashlen :
(unsigned int) ( mbedtls_md_get_size( mbedtls_md_info_from_type( md_alg ) ) ) );
if( ssl->session_negotiate->peer_cert == NULL )
{
MBEDTLS_SSL_DEBUG_MSG( 2, ( "certificate required" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
return( MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE );
}
/*
* Verify signature
*/
if( ! mbedtls_pk_can_do( &ssl->session_negotiate->peer_cert->pk, pk_alg ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
return( MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH );
}
if( ( ret = mbedtls_pk_verify( &ssl->session_negotiate->peer_cert->pk,
md_alg, hash, hashlen, p, sig_len ) ) != 0 )
{
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_pk_verify", ret );
return( ret );
}
}
#endif /* MBEDTLS_KEY_EXCHANGE__WITH_SERVER_SIGNATURE__ENABLED */
exit:
ssl->state++;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse server key exchange" ) );
return( 0 );
}
| 16,660 |
136,333 | 0 | bool PaintPropertyTreeBuilder::UpdateForSelf() {
UpdatePaintingLayer();
bool property_added_or_removed = false;
if (ObjectTypeMightNeedPaintProperties())
property_added_or_removed = UpdateFragments();
else
object_.GetMutableForPainting().FirstFragment().ClearNextFragment();
bool property_changed = false;
auto* fragment_data = &object_.GetMutableForPainting().FirstFragment();
for (auto& fragment_context : context_.fragments) {
FragmentPaintPropertyTreeBuilder builder(object_, context_,
fragment_context, *fragment_data);
builder.UpdateForSelf();
property_changed |= builder.PropertyChanged();
property_added_or_removed |= builder.PropertyAddedOrRemoved();
fragment_data = fragment_data->NextFragment();
}
DCHECK(!fragment_data);
if (property_added_or_removed &&
RuntimeEnabledFeatures::SlimmingPaintV175Enabled())
context_.painting_layer->SetNeedsRepaint();
return property_changed;
}
| 16,661 |
98,387 | 0 | GtkPolicyType webkit_web_frame_get_horizontal_scrollbar_policy(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), GTK_POLICY_AUTOMATIC);
Frame* coreFrame = core(frame);
FrameView* view = coreFrame->view();
if (!view)
return GTK_POLICY_AUTOMATIC;
ScrollbarMode hMode = view->horizontalScrollbarMode();
if (hMode == ScrollbarAlwaysOn)
return GTK_POLICY_ALWAYS;
if (hMode == ScrollbarAlwaysOff)
return GTK_POLICY_NEVER;
return GTK_POLICY_AUTOMATIC;
}
| 16,662 |
13,021 | 0 | sshpkt_put_cstring(struct ssh *ssh, const void *v)
{
return sshbuf_put_cstring(ssh->state->outgoing_packet, v);
}
| 16,663 |
44,210 | 0 | void SSL_SESSION_get0_ticket(const SSL_SESSION *s, unsigned char **tick,
size_t *len)
{
*len = s->tlsext_ticklen;
if (tick != NULL)
*tick = s->tlsext_tick;
}
| 16,664 |
138,366 | 0 | std::unique_ptr<ServiceManagerConnection> ServiceManagerConnection::Create(
service_manager::mojom::ServiceRequest request,
scoped_refptr<base::SequencedTaskRunner> io_task_runner) {
if (service_manager_connection_factory)
return service_manager_connection_factory->Run();
return base::MakeUnique<ServiceManagerConnectionImpl>(
std::move(request), io_task_runner);
}
| 16,665 |
52,025 | 0 | dissect_SPOOL_PRINTER_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep)
{
proto_tree *subtree;
guint32 level;
proto_tree *item;
subtree = proto_tree_add_subtree(
tree, tvb, offset, 0, ett_SPOOL_PRINTER_INFO_LEVEL, &item, "Spool printer info level");
offset = dissect_ndr_uint32(
tvb, offset, pinfo, subtree, di, drep, hf_level, &level);
switch(level) {
case 3: {
guint32 devmode_ptr, secdesc_ptr;
/* I can't seem to get this working with the correct
dissect_ndr_pointer() function so let's cheat and
dissect the pointers by hand. )-: */
offset = dissect_ndr_uint32(
tvb, offset, pinfo, subtree, di, drep,
hf_spool_printer_info_devmode_ptr,
&devmode_ptr);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, subtree, di, drep,
hf_spool_printer_info_secdesc_ptr,
&secdesc_ptr);
if (devmode_ptr)
offset = dissect_DEVMODE_CTR(
tvb, offset, pinfo, subtree, di, drep);
if (secdesc_ptr)
offset = dissect_SEC_DESC_BUF(
tvb, offset, pinfo, subtree, di, drep);
break;
}
case 2:
default:
expert_add_info_format(pinfo, item, &ei_spool_printer_info_level, "Unknown spool printer info level %d", level);
break;
}
return offset;
}
| 16,666 |
23,014 | 0 | static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
{
__be32 *p;
uint32_t bmlen;
int status;
status = decode_op_hdr(xdr, OP_CREATE);
if (status)
return status;
if ((status = decode_change_info(xdr, cinfo)))
return status;
READ_BUF(4);
READ32(bmlen);
READ_BUF(bmlen << 2);
return 0;
}
| 16,667 |
37,067 | 0 | static int handle_dr(struct kvm_vcpu *vcpu)
{
unsigned long exit_qualification;
int dr, reg;
/* Do not handle if the CPL > 0, will trigger GP on re-entry */
if (!kvm_require_cpl(vcpu, 0))
return 1;
dr = vmcs_readl(GUEST_DR7);
if (dr & DR7_GD) {
/*
* As the vm-exit takes precedence over the debug trap, we
* need to emulate the latter, either for the host or the
* guest debugging itself.
*/
if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) {
vcpu->run->debug.arch.dr6 = vcpu->arch.dr6;
vcpu->run->debug.arch.dr7 = dr;
vcpu->run->debug.arch.pc =
vmcs_readl(GUEST_CS_BASE) +
vmcs_readl(GUEST_RIP);
vcpu->run->debug.arch.exception = DB_VECTOR;
vcpu->run->exit_reason = KVM_EXIT_DEBUG;
return 0;
} else {
vcpu->arch.dr7 &= ~DR7_GD;
vcpu->arch.dr6 |= DR6_BD | DR6_RTM;
vmcs_writel(GUEST_DR7, vcpu->arch.dr7);
kvm_queue_exception(vcpu, DB_VECTOR);
return 1;
}
}
if (vcpu->guest_debug == 0) {
u32 cpu_based_vm_exec_control;
cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
cpu_based_vm_exec_control &= ~CPU_BASED_MOV_DR_EXITING;
vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
/*
* No more DR vmexits; force a reload of the debug registers
* and reenter on this instruction. The next vmexit will
* retrieve the full state of the debug registers.
*/
vcpu->arch.switch_db_regs |= KVM_DEBUGREG_WONT_EXIT;
return 1;
}
exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
dr = exit_qualification & DEBUG_REG_ACCESS_NUM;
reg = DEBUG_REG_ACCESS_REG(exit_qualification);
if (exit_qualification & TYPE_MOV_FROM_DR) {
unsigned long val;
if (kvm_get_dr(vcpu, dr, &val))
return 1;
kvm_register_write(vcpu, reg, val);
} else
if (kvm_set_dr(vcpu, dr, kvm_register_readl(vcpu, reg)))
return 1;
skip_emulated_instruction(vcpu);
return 1;
}
| 16,668 |
12,857 | 0 | const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void)
{
return NULL;
}
| 16,669 |
98,117 | 0 | void RenderView::printPage(WebFrame* frame) {
DCHECK(frame);
Print(frame, true);
}
| 16,670 |
89,373 | 0 | struct blk_desc *blk_get_dev(const char *ifname, int dev)
{
return get_dev_hwpart(ifname, dev, 0);
}
| 16,671 |
136,016 | 0 | void ChildProcessSecurityPolicyImpl::GrantCreateReadWriteFileSystem(
int child_id, const std::string& filesystem_id) {
GrantPermissionsForFileSystem(
child_id, filesystem_id, CREATE_READ_WRITE_FILE_GRANT);
}
| 16,672 |
146,879 | 0 | Node* Document::cloneNode(bool deep, ExceptionState&) {
Document* clone = CloneDocumentWithoutChildren();
clone->CloneDataFromDocument(*this);
if (deep)
CloneChildNodes(clone);
return clone;
}
| 16,673 |
73,279 | 0 | ASS_Shaper *ass_shaper_new(size_t prealloc)
{
ASS_Shaper *shaper = calloc(sizeof(*shaper), 1);
if (!shaper)
return NULL;
shaper->base_direction = FRIBIDI_PAR_ON;
if (!check_allocations(shaper, prealloc))
goto error;
#ifdef CONFIG_HARFBUZZ
if (!init_features(shaper))
goto error;
shaper->metrics_cache = ass_glyph_metrics_cache_create();
if (!shaper->metrics_cache)
goto error;
#endif
return shaper;
error:
ass_shaper_free(shaper);
return NULL;
}
| 16,674 |
57,156 | 0 | static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
{
struct nfs_server *server = NFS_SERVER(state->inode);
struct nfs4_exception exception = {
.inode = state->inode,
};
int err;
err = nfs4_set_lock_state(state, request);
if (err != 0)
return err;
if (!recover_lost_locks) {
set_bit(NFS_LOCK_LOST, &request->fl_u.nfs4_fl.owner->ls_flags);
return 0;
}
do {
if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0)
return 0;
err = _nfs4_do_setlk(state, F_SETLK, request, NFS_LOCK_EXPIRED);
trace_nfs4_lock_expired(request, state, F_SETLK, err);
switch (err) {
default:
goto out;
case -NFS4ERR_GRACE:
case -NFS4ERR_DELAY:
nfs4_handle_exception(server, err, &exception);
err = 0;
}
} while (exception.retry);
out:
return err;
}
| 16,675 |
21,840 | 0 | static int segmented_read_std(struct x86_emulate_ctxt *ctxt,
struct segmented_address addr,
void *data,
unsigned size)
{
int rc;
ulong linear;
rc = linearize(ctxt, addr, size, false, &linear);
if (rc != X86EMUL_CONTINUE)
return rc;
return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception);
}
| 16,676 |
22,789 | 0 | void nfs_fattr_init(struct nfs_fattr *fattr)
{
fattr->valid = 0;
fattr->time_start = jiffies;
fattr->gencount = nfs_inc_attr_generation_counter();
}
| 16,677 |
168,564 | 0 | static int unsupported_open(int sub_api, struct libusb_device_handle *dev_handle) {
PRINT_UNSUPPORTED_API(open);
}
| 16,678 |
177,198 | 0 | void ACodec::PortDescription::addBuffer(
IOMX::buffer_id id, const sp<ABuffer> &buffer) {
mBufferIDs.push_back(id);
mBuffers.push_back(buffer);
}
| 16,679 |
38,798 | 0 | box_center(PG_FUNCTION_ARGS)
{
BOX *box = PG_GETARG_BOX_P(0);
Point *result = (Point *) palloc(sizeof(Point));
box_cn(result, box);
PG_RETURN_POINT_P(result);
}
| 16,680 |
50,837 | 0 | isoent_make_path_table(struct archive_write *a)
{
struct iso9660 *iso9660 = a->format_data;
int depth, r;
int dir_number;
/*
* Init Path Table.
*/
if (iso9660->dircnt_max >= MAX_DEPTH &&
(!iso9660->opt.limit_depth || iso9660->opt.iso_level == 4))
r = isoent_alloc_path_table(a, &(iso9660->primary),
iso9660->dircnt_max + 1);
else
/* The number of levels in the hierarchy cannot exceed
* eight. */
r = isoent_alloc_path_table(a, &(iso9660->primary),
MAX_DEPTH);
if (r < 0)
return (r);
if (iso9660->opt.joliet) {
r = isoent_alloc_path_table(a, &(iso9660->joliet),
iso9660->dircnt_max + 1);
if (r < 0)
return (r);
}
/* Step 0.
* - Collect directories for primary and joliet.
*/
isoent_collect_dirs(&(iso9660->primary), NULL, 0);
if (iso9660->opt.joliet)
isoent_collect_dirs(&(iso9660->joliet), NULL, 0);
/*
* Rockridge; move deeper depth directories to rr_moved.
*/
if (iso9660->opt.rr) {
r = isoent_rr_move(a);
if (r < 0)
return (r);
}
/* Update nlink. */
isofile_connect_hardlink_files(iso9660);
/* Step 1.
* - Renew a value of the depth of that directories.
* - Resolve hardlinks.
* - Convert pathnames to ISO9660 name or UCS2(joliet).
* - Sort files by each directory.
*/
r = isoent_traverse_tree(a, &(iso9660->primary));
if (r < 0)
return (r);
if (iso9660->opt.joliet) {
r = isoent_traverse_tree(a, &(iso9660->joliet));
if (r < 0)
return (r);
}
/* Step 2.
* - Sort directories.
* - Assign all directory number.
*/
dir_number = 1;
for (depth = 0; depth < iso9660->primary.max_depth; depth++) {
r = isoent_make_path_table_2(a, &(iso9660->primary),
depth, &dir_number);
if (r < 0)
return (r);
}
if (iso9660->opt.joliet) {
dir_number = 1;
for (depth = 0; depth < iso9660->joliet.max_depth; depth++) {
r = isoent_make_path_table_2(a, &(iso9660->joliet),
depth, &dir_number);
if (r < 0)
return (r);
}
}
if (iso9660->opt.limit_dirs && dir_number > 0xffff) {
/*
* Maximum number of directories is 65535(0xffff)
* doe to size(16bit) of Parent Directory Number of
* the Path Table.
* See also ISO9660 Standard 9.4.
*/
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Too many directories(%d) over 65535.", dir_number);
return (ARCHIVE_FATAL);
}
/* Get the size of the Path Table. */
calculate_path_table_size(&(iso9660->primary));
if (iso9660->opt.joliet)
calculate_path_table_size(&(iso9660->joliet));
return (ARCHIVE_OK);
}
| 16,681 |
176,850 | 0 | static void dut_mode_recv_callback (uint16_t opcode, uint8_t *buf, uint8_t len) {
}
| 16,682 |
19,093 | 0 | int udp_lib_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, unsigned int optlen,
int (*push_pending_frames)(struct sock *))
{
struct udp_sock *up = udp_sk(sk);
int val;
int err = 0;
int is_udplite = IS_UDPLITE(sk);
if (optlen < sizeof(int))
return -EINVAL;
if (get_user(val, (int __user *)optval))
return -EFAULT;
switch (optname) {
case UDP_CORK:
if (val != 0) {
up->corkflag = 1;
} else {
up->corkflag = 0;
lock_sock(sk);
(*push_pending_frames)(sk);
release_sock(sk);
}
break;
case UDP_ENCAP:
switch (val) {
case 0:
case UDP_ENCAP_ESPINUDP:
case UDP_ENCAP_ESPINUDP_NON_IKE:
up->encap_rcv = xfrm4_udp_encap_rcv;
/* FALLTHROUGH */
case UDP_ENCAP_L2TPINUDP:
up->encap_type = val;
break;
default:
err = -ENOPROTOOPT;
break;
}
break;
/*
* UDP-Lite's partial checksum coverage (RFC 3828).
*/
/* The sender sets actual checksum coverage length via this option.
* The case coverage > packet length is handled by send module. */
case UDPLITE_SEND_CSCOV:
if (!is_udplite) /* Disable the option on UDP sockets */
return -ENOPROTOOPT;
if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
val = 8;
else if (val > USHRT_MAX)
val = USHRT_MAX;
up->pcslen = val;
up->pcflag |= UDPLITE_SEND_CC;
break;
/* The receiver specifies a minimum checksum coverage value. To make
* sense, this should be set to at least 8 (as done below). If zero is
* used, this again means full checksum coverage. */
case UDPLITE_RECV_CSCOV:
if (!is_udplite) /* Disable the option on UDP sockets */
return -ENOPROTOOPT;
if (val != 0 && val < 8) /* Avoid silly minimal values. */
val = 8;
else if (val > USHRT_MAX)
val = USHRT_MAX;
up->pcrlen = val;
up->pcflag |= UDPLITE_RECV_CC;
break;
default:
err = -ENOPROTOOPT;
break;
}
return err;
}
| 16,683 |
1,017 | 0 | void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
#ifdef USE_CMS
if (transform != NULL && displayPixelType == PT_CMYK) {
Guchar in[gfxColorMaxComps];
Guchar out[gfxColorMaxComps];
for (int i = 0;i < nComps;i++) {
in[i] = colToByte(color->c[i]);
}
transform->doTransform(in,out,1);
cmyk->c = byteToCol(out[0]);
cmyk->m = byteToCol(out[1]);
cmyk->y = byteToCol(out[2]);
cmyk->k = byteToCol(out[3]);
} else {
GfxRGB rgb;
GfxColorComp c, m, y, k;
getRGB(color,&rgb);
c = clip01(gfxColorComp1 - rgb.r);
m = clip01(gfxColorComp1 - rgb.g);
y = clip01(gfxColorComp1 - rgb.b);
k = c;
if (m < k) {
k = m;
}
if (y < k) {
k = y;
}
cmyk->c = c - k;
cmyk->m = m - k;
cmyk->y = y - k;
cmyk->k = k;
}
#else
alt->getCMYK(color, cmyk);
#endif
}
| 16,684 |
122,593 | 0 | WebDevToolsAgentImpl::~WebDevToolsAgentImpl()
{
ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl);
if (m_attached)
blink::Platform::current()->currentThread()->removeTaskObserver(this);
}
| 16,685 |
186,630 | 1 | void AppCacheGroup::RemoveCache(AppCache* cache) {
DCHECK(cache->associated_hosts().empty());
if (cache == newest_complete_cache_) {
CancelUpdate();
AppCache* tmp_cache = newest_complete_cache_;
newest_complete_cache_ = nullptr;
tmp_cache->set_owning_group(nullptr); // may cause this group to be deleted
} else {
scoped_refptr<AppCacheGroup> protect(this);
Caches::iterator it =
std::find(old_caches_.begin(), old_caches_.end(), cache);
if (it != old_caches_.end()) {
AppCache* tmp_cache = *it;
old_caches_.erase(it);
tmp_cache->set_owning_group(nullptr); // may cause group to be released
}
if (!is_obsolete() && old_caches_.empty() &&
!newly_deletable_response_ids_.empty()) {
storage_->DeleteResponses(manifest_url_, newly_deletable_response_ids_);
newly_deletable_response_ids_.clear();
}
}
}
| 16,686 |
73,270 | 0 | int rxe_mem_init_fast(struct rxe_dev *rxe, struct rxe_pd *pd,
int max_pages, struct rxe_mem *mem)
{
int err;
rxe_mem_init(0, mem);
/* In fastreg, we also set the rkey */
mem->ibmr.rkey = mem->ibmr.lkey;
err = rxe_mem_alloc(rxe, mem, max_pages);
if (err)
goto err1;
mem->pd = pd;
mem->max_buf = max_pages;
mem->state = RXE_MEM_STATE_FREE;
mem->type = RXE_MEM_TYPE_MR;
return 0;
err1:
return err;
}
| 16,687 |
18,502 | 0 | hotremove_migrate_alloc(struct page *page, unsigned long private, int **x)
{
/* This should be improooooved!! */
return alloc_page(GFP_HIGHUSER_MOVABLE);
}
| 16,688 |
138,869 | 0 | void WallpaperManager::AddObservers() {
show_user_name_on_signin_subscription_ =
CrosSettings::Get()->AddSettingsObserver(
kAccountsPrefShowUserNamesOnSignIn,
base::Bind(&WallpaperManager::InitializeRegisteredDeviceWallpaper,
weak_factory_.GetWeakPtr()));
device_wallpaper_image_subscription_ =
CrosSettings::Get()->AddSettingsObserver(
kDeviceWallpaperImage,
base::Bind(&WallpaperManager::OnDeviceWallpaperPolicyChanged,
weak_factory_.GetWeakPtr()));
}
| 16,689 |
51,585 | 0 | static bool tcp_prune_ofo_queue(struct sock *sk)
{
struct tcp_sock *tp = tcp_sk(sk);
bool res = false;
if (!skb_queue_empty(&tp->out_of_order_queue)) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED);
__skb_queue_purge(&tp->out_of_order_queue);
/* Reset SACK state. A conforming SACK implementation will
* do the same at a timeout based retransmit. When a connection
* is in a sad state like this, we care only about integrity
* of the connection not performance.
*/
if (tp->rx_opt.sack_ok)
tcp_sack_reset(&tp->rx_opt);
sk_mem_reclaim(sk);
res = true;
}
return res;
}
| 16,690 |
118,005 | 0 | static inline void resourceInfo(const v8::Handle<v8::Function> function, String& resourceName, int& lineNumber)
{
v8::ScriptOrigin origin = function->GetScriptOrigin();
if (origin.ResourceName().IsEmpty()) {
resourceName = "undefined";
lineNumber = 1;
} else {
resourceName = toWebCoreString(origin.ResourceName());
lineNumber = function->GetScriptLineNumber() + 1;
}
}
| 16,691 |
149,184 | 0 | void LockScreenMediaControlsView::SetIsPlaying(bool playing) {
MediaSessionAction action =
playing ? MediaSessionAction::kPause : MediaSessionAction::kPlay;
play_pause_button_->SetToggled(!playing);
play_pause_button_->set_tag(static_cast<int>(action));
UpdateActionButtonsVisibility();
}
| 16,692 |
152,449 | 0 | void RenderFrameImpl::OnSelectPopupMenuItem(int selected_index) {
if (external_popup_menu_ == NULL)
return;
blink::WebScopedUserGesture gesture(frame_);
std::unique_ptr<ExternalPopupMenu> popup;
popup.swap(external_popup_menu_);
popup->DidSelectItem(selected_index);
}
| 16,693 |
26,569 | 0 | static int packet_release(struct socket *sock)
{
struct sock *sk = sock->sk;
struct packet_sock *po;
struct net *net;
struct tpacket_req req;
if (!sk)
return 0;
net = sock_net(sk);
po = pkt_sk(sk);
spin_lock_bh(&net->packet.sklist_lock);
sk_del_node_init_rcu(sk);
sock_prot_inuse_add(net, sk->sk_prot, -1);
spin_unlock_bh(&net->packet.sklist_lock);
spin_lock(&po->bind_lock);
if (po->running) {
/*
* Remove from protocol table
*/
po->running = 0;
po->num = 0;
__dev_remove_pack(&po->prot_hook);
__sock_put(sk);
}
spin_unlock(&po->bind_lock);
packet_flush_mclist(sk);
memset(&req, 0, sizeof(req));
if (po->rx_ring.pg_vec)
packet_set_ring(sk, &req, 1, 0);
if (po->tx_ring.pg_vec)
packet_set_ring(sk, &req, 1, 1);
synchronize_net();
/*
* Now the socket is dead. No more input will appear.
*/
sock_orphan(sk);
sock->sk = NULL;
/* Purge queues */
skb_queue_purge(&sk->sk_receive_queue);
sk_refcnt_debug_release(sk);
sock_put(sk);
return 0;
}
| 16,694 |
131,331 | 0 | static void customSetterLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
V8TestObjectPython::customSetterLongAttributeAttributeSetterCustom(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 16,695 |
42,017 | 0 | static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminfo64 *in, int version)
{
switch (version) {
case IPC_64:
return copy_to_user(buf, in, sizeof(*in));
case IPC_OLD:
{
struct shminfo out;
if (in->shmmax > INT_MAX)
out.shmmax = INT_MAX;
else
out.shmmax = (int)in->shmmax;
out.shmmin = in->shmmin;
out.shmmni = in->shmmni;
out.shmseg = in->shmseg;
out.shmall = in->shmall;
return copy_to_user(buf, &out, sizeof(out));
}
default:
return -EINVAL;
}
}
| 16,696 |
178,616 | 1 | SProcXFixesQueryVersion(ClientPtr client)
{
REQUEST(xXFixesQueryVersionReq);
swaps(&stuff->length);
swapl(&stuff->majorVersion);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
| 16,697 |
187,651 | 1 | image_transform_png_set_expand_add(image_transform *this,
PNG_CONST image_transform **that, png_byte colour_type, png_byte bit_depth)
{
UNUSED(bit_depth)
this->next = *that;
*that = this;
/* 'expand' should do nothing for RGBA or GA input - no tRNS and the bit
* depth is at least 8 already.
*/
return (colour_type & PNG_COLOR_MASK_ALPHA) == 0;
}
| 16,698 |
129,115 | 0 | bool PermissionsData::HasAPIPermission(APIPermission::ID permission) const {
return active_permissions()->HasAPIPermission(permission);
}
| 16,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.