idx
int64 | func
string | target
int64 |
|---|---|---|
9,342
|
png_get_copyright(png_structp png_ptr)
{
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.2.52 - November 20, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.2.52 - November 20, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
#endif
#endif
}
| 1
|
212,324
|
gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc)
{
gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
const gs_shading_t *psh = pinst->templat.Shading;
if (!psh->params.have_BBox)
return_error(gs_error_unregistered); /* Do not call in this case. */
else {
gs_gstate *pgs = pinst->saved;
return gs_shading_path_add_box(ppath, &psh->params.BBox, &pgs->ctm);
}
}
| 0
|
7,230
|
static void vgacon_scrolldelta(struct vc_data *c, int lines)
{
vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,
vga_vram_size);
vga_set_mem_top(c);
}
| 1
|
104,577
|
int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{
DBUG_ENTER("mysql_send_query");
DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
| 0
|
270,044
|
dir_is_locked (GFile *dir)
{
glnx_autofd int ref_fd = -1;
struct flock lock = {0};
g_autoptr(GFile) reffile = NULL;
reffile = g_file_resolve_relative_path (dir, "files/.ref");
ref_fd = open (flatpak_file_get_path_cached (reffile), O_RDWR | O_CLOEXEC);
if (ref_fd != -1)
{
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0;
if (fcntl (ref_fd, F_GETLK, &lock) == 0)
return lock.l_type != F_UNLCK;
}
return FALSE;
}
| 0
|
310,922
|
run_selftests (int algo, int extended, selftest_report_func_t report)
{
(void)extended;
if (algo != GCRY_PK_ECC)
return GPG_ERR_PUBKEY_ALGO;
return selftests_ecdsa (report);
}
| 0
|
439,167
|
static void inode_dnode_free(dnode_t *node,
void *context EXT2FS_ATTR((unused)))
{
struct dup_inode *di;
struct cluster_el *p, *next;
di = (struct dup_inode *) dnode_get(node);
for (p = di->cluster_list; p; p = next) {
next = p->next;
free(p);
}
free(di);
free(node);
}
| 0
|
67,905
|
static struct dm_table *dm_get_inactive_table(struct mapped_device *md, int *srcu_idx)
{
struct hash_cell *hc;
struct dm_table *table = NULL;
/* increment rcu count, we don't care about the table pointer */
dm_get_live_table(md, srcu_idx);
down_read(&_hash_lock);
hc = dm_get_mdptr(md);
if (!hc || hc->md != md) {
DMWARN("device has been removed from the dev hash table.");
goto out;
}
table = hc->new_map;
out:
up_read(&_hash_lock);
return table;
}
| 0
|
415,319
|
disconnect_callback (GDBusProxy *proxy,
GAsyncResult *res,
GSimpleAsyncResult *simple)
{
gboolean retval;
GError *error = NULL;
retval = device1_call_disconnect_finish (DEVICE1(proxy), res, &error);
if (retval == FALSE) {
g_debug ("Disconnect failed for %s: %s",
g_dbus_proxy_get_object_path (proxy),
error->message);
g_simple_async_result_take_error (simple, error);
} else {
g_debug ("Disconnect succeeded for %s",
g_dbus_proxy_get_object_path (proxy));
g_simple_async_result_set_op_res_gboolean (simple, retval);
}
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
}
| 0
|
430,048
|
int htp_hdr_valcb(llhttp_t *htp, const char *data, size_t len) {
auto upstream = static_cast<HttpsUpstream *>(htp->data);
auto downstream = upstream->get_downstream();
auto &req = downstream->request();
if (req.fs.buffer_size() + len >
get_config()->http.request_header_field_buffer) {
if (LOG_ENABLED(INFO)) {
ULOG(INFO, upstream) << "Too large header block size="
<< req.fs.buffer_size() + len;
}
if (downstream->get_request_state() == DownstreamState::INITIAL) {
downstream->set_request_state(
DownstreamState::HTTP1_REQUEST_HEADER_TOO_LARGE);
}
llhttp_set_error_reason(htp, "too large header");
return HPE_USER;
}
if (downstream->get_request_state() == DownstreamState::INITIAL) {
req.fs.append_last_header_value(data, len);
} else {
req.fs.append_last_trailer_value(data, len);
}
return 0;
}
| 0
|
80,427
|
void rcuwait_wake_up(struct rcuwait *w)
{
struct task_struct *task;
rcu_read_lock();
/*
* Order condition vs @task, such that everything prior to the load
* of @task is visible. This is the condition as to why the user called
* rcuwait_trywake() in the first place. Pairs with set_current_state()
* barrier (A) in rcuwait_wait_event().
*
* WAIT WAKE
* [S] tsk = current [S] cond = true
* MB (A) MB (B)
* [L] cond [L] tsk
*/
smp_rmb(); /* (B) */
/*
* Avoid using task_rcu_dereference() magic as long as we are careful,
* see comment in rcuwait_wait_event() regarding ->exit_state.
*/
task = rcu_dereference(w->task);
if (task)
wake_up_process(task);
rcu_read_unlock();
}
| 0
|
219,469
|
void CSoundFile::MidiPortamento(CHANNELINDEX nChn, int param, bool doFineSlides)
{
int actualParam = mpt::abs(param);
int pitchBend = 0;
if(doFineSlides && actualParam >= 0xE0 && !m_playBehaviour[kOldMIDIPitchBends])
{
if(m_PlayState.Chn[nChn].isFirstTick)
{
pitchBend = (actualParam & 0x0F) * sgn(param);
if(actualParam >= 0xF0)
{
pitchBend *= 4;
}
}
} else if(!m_PlayState.Chn[nChn].isFirstTick || m_playBehaviour[kOldMIDIPitchBends])
{
pitchBend = param * 4;
}
if(pitchBend)
{
#ifndef NO_PLUGINS
IMixPlugin *plugin = GetChannelInstrumentPlugin(nChn);
if(plugin != nullptr)
{
int8 pwd = 13; // Early OpenMPT legacy... Actually it's not *exactly* 13, but close enough...
if(m_PlayState.Chn[nChn].pModInstrument != nullptr)
{
pwd = m_PlayState.Chn[nChn].pModInstrument->midiPWD;
}
plugin->MidiPitchBend(GetBestMidiChannel(nChn), pitchBend, pwd);
}
#endif // NO_PLUGINS
}
}
| 0
|
467,640
|
static int _annotate_rewrite(struct mailbox *oldmailbox,
uint32_t olduid,
const char *olduserid,
struct mailbox *newmailbox,
uint32_t newuid,
const char *newuserid,
int copy)
{
struct rename_rock rrock;
rrock.oldmailbox = oldmailbox;
rrock.newmailbox = newmailbox;
rrock.olduserid = olduserid;
rrock.newuserid = newuserid;
rrock.olduid = olduid;
rrock.newuid = newuid;
rrock.copy = copy;
return annotatemore_findall(oldmailbox->name, olduid, "*", /*modseq*/0,
&rename_cb, &rrock, /*flags*/0);
}
| 0
|
306,253
|
irc_protocol_recv_command (struct t_irc_server *server,
const char *irc_message,
const char *msg_command,
const char *msg_channel)
{
int i, cmd_found, return_code, argc, decode_color, keep_trailing_spaces;
int message_ignored, flags;
char *message_colors_decoded, *pos_space, *tags;
struct t_irc_channel *ptr_channel;
t_irc_recv_func *cmd_recv_func;
const char *cmd_name, *ptr_msg_after_tags;
time_t date;
const char *nick1, *address1, *host1;
char *nick, *address, *address_color, *host, *host_no_color, *host_color;
char **argv, **argv_eol;
struct t_hashtable *hash_tags;
struct t_irc_protocol_msg irc_protocol_messages[] =
{ { "account", /* account (cap account-notify) */ 1, 0, &irc_protocol_cb_account },
{ "authenticate", /* authenticate */ 1, 0, &irc_protocol_cb_authenticate },
{ "away", /* away (cap away-notify) */ 1, 0, &irc_protocol_cb_away },
{ "cap", /* client capability */ 1, 0, &irc_protocol_cb_cap },
{ "chghost", /* user/host change (cap chghost) */ 1, 0, &irc_protocol_cb_chghost },
{ "error", /* error received from IRC server */ 1, 0, &irc_protocol_cb_error },
{ "invite", /* invite a nick on a channel */ 1, 0, &irc_protocol_cb_invite },
{ "join", /* join a channel */ 1, 0, &irc_protocol_cb_join },
{ "kick", /* forcibly remove a user from a channel */ 1, 1, &irc_protocol_cb_kick },
{ "kill", /* close client-server connection */ 1, 1, &irc_protocol_cb_kill },
{ "mode", /* change channel or user mode */ 1, 0, &irc_protocol_cb_mode },
{ "nick", /* change current nickname */ 1, 0, &irc_protocol_cb_nick },
{ "notice", /* send notice message to user */ 1, 1, &irc_protocol_cb_notice },
{ "part", /* leave a channel */ 1, 1, &irc_protocol_cb_part },
{ "ping", /* ping server */ 1, 0, &irc_protocol_cb_ping },
{ "pong", /* answer to a ping message */ 1, 0, &irc_protocol_cb_pong },
{ "privmsg", /* message received */ 1, 1, &irc_protocol_cb_privmsg },
{ "quit", /* close all connections and quit */ 1, 1, &irc_protocol_cb_quit },
{ "topic", /* get/set channel topic */ 0, 1, &irc_protocol_cb_topic },
{ "wallops", /* send a message to all currently connected users who have "
"set the 'w' user mode "
"for themselves */ 1, 1, &irc_protocol_cb_wallops },
{ "001", /* a server message */ 1, 0, &irc_protocol_cb_001 },
{ "005", /* a server message */ 1, 0, &irc_protocol_cb_005 },
{ "008", /* server notice mask */ 1, 0, &irc_protocol_cb_008 },
{ "221", /* user mode string */ 1, 0, &irc_protocol_cb_221 },
{ "223", /* whois (charset is) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "264", /* whois (is using encrypted connection) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "275", /* whois (secure connection) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "276", /* whois (has client certificate fingerprint) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "301", /* away message */ 1, 1, &irc_protocol_cb_301 },
{ "303", /* ison */ 1, 0, &irc_protocol_cb_303 },
{ "305", /* unaway */ 1, 0, &irc_protocol_cb_305 },
{ "306", /* now away */ 1, 0, &irc_protocol_cb_306 },
{ "307", /* whois (registered nick) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "310", /* whois (help mode) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "311", /* whois (user) */ 1, 0, &irc_protocol_cb_311 },
{ "312", /* whois (server) */ 1, 0, &irc_protocol_cb_312 },
{ "313", /* whois (operator) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "314", /* whowas */ 1, 0, &irc_protocol_cb_314 },
{ "315", /* end of /who list */ 1, 0, &irc_protocol_cb_315 },
{ "317", /* whois (idle) */ 1, 0, &irc_protocol_cb_317 },
{ "318", /* whois (end) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "319", /* whois (channels) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "320", /* whois (identified user) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "321", /* /list start */ 1, 0, &irc_protocol_cb_321 },
{ "322", /* channel (for /list) */ 1, 0, &irc_protocol_cb_322 },
{ "323", /* end of /list */ 1, 0, &irc_protocol_cb_323 },
{ "324", /* channel mode */ 1, 0, &irc_protocol_cb_324 },
{ "326", /* whois (has oper privs) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "327", /* whois (host) */ 1, 0, &irc_protocol_cb_327 },
{ "328", /* channel url */ 1, 0, &irc_protocol_cb_328 },
{ "329", /* channel creation date */ 1, 0, &irc_protocol_cb_329 },
{ "330", /* is logged in as */ 1, 0, &irc_protocol_cb_330_343 },
{ "331", /* no topic for channel */ 1, 0, &irc_protocol_cb_331 },
{ "332", /* topic of channel */ 0, 1, &irc_protocol_cb_332 },
{ "333", /* infos about topic (nick and date changed) */ 1, 0, &irc_protocol_cb_333 },
{ "335", /* is a bot on */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "338", /* whois (host) */ 1, 0, &irc_protocol_cb_338 },
{ "341", /* inviting */ 1, 0, &irc_protocol_cb_341 },
{ "343", /* is opered as */ 1, 0, &irc_protocol_cb_330_343 },
{ "344", /* channel reop */ 1, 0, &irc_protocol_cb_344 },
{ "345", /* end of channel reop list */ 1, 0, &irc_protocol_cb_345 },
{ "346", /* invite list */ 1, 0, &irc_protocol_cb_346 },
{ "347", /* end of invite list */ 1, 0, &irc_protocol_cb_347 },
{ "348", /* channel exception list */ 1, 0, &irc_protocol_cb_348 },
{ "349", /* end of channel exception list */ 1, 0, &irc_protocol_cb_349 },
{ "351", /* server version */ 1, 0, &irc_protocol_cb_351 },
{ "352", /* who */ 1, 0, &irc_protocol_cb_352 },
{ "353", /* list of nicks on channel */ 1, 0, &irc_protocol_cb_353 },
{ "354", /* whox */ 1, 0, &irc_protocol_cb_354 },
{ "366", /* end of /names list */ 1, 0, &irc_protocol_cb_366 },
{ "367", /* banlist */ 1, 0, &irc_protocol_cb_367 },
{ "368", /* end of banlist */ 1, 0, &irc_protocol_cb_368 },
{ "369", /* whowas (end) */ 1, 0, &irc_protocol_cb_whowas_nick_msg },
{ "378", /* whois (connecting from) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "379", /* whois (using modes) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "401", /* no such nick/channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "402", /* no such server */ 1, 0, &irc_protocol_cb_generic_error },
{ "403", /* no such channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "404", /* cannot send to channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "405", /* too many channels */ 1, 0, &irc_protocol_cb_generic_error },
{ "406", /* was no such nick */ 1, 0, &irc_protocol_cb_generic_error },
{ "407", /* was no such nick */ 1, 0, &irc_protocol_cb_generic_error },
{ "409", /* no origin */ 1, 0, &irc_protocol_cb_generic_error },
{ "410", /* no services */ 1, 0, &irc_protocol_cb_generic_error },
{ "411", /* no recipient */ 1, 0, &irc_protocol_cb_generic_error },
{ "412", /* no text to send */ 1, 0, &irc_protocol_cb_generic_error },
{ "413", /* no toplevel */ 1, 0, &irc_protocol_cb_generic_error },
{ "414", /* wilcard in toplevel domain */ 1, 0, &irc_protocol_cb_generic_error },
{ "421", /* unknown command */ 1, 0, &irc_protocol_cb_generic_error },
{ "422", /* MOTD is missing */ 1, 0, &irc_protocol_cb_generic_error },
{ "423", /* no administrative info */ 1, 0, &irc_protocol_cb_generic_error },
{ "424", /* file error */ 1, 0, &irc_protocol_cb_generic_error },
{ "431", /* no nickname given */ 1, 0, &irc_protocol_cb_generic_error },
{ "432", /* erroneous nickname */ 1, 0, &irc_protocol_cb_432 },
{ "433", /* nickname already in use */ 1, 0, &irc_protocol_cb_433 },
{ "436", /* nickname collision */ 1, 0, &irc_protocol_cb_generic_error },
{ "437", /* nick/channel unavailable */ 1, 0, &irc_protocol_cb_437 },
{ "438", /* not authorized to change nickname */ 1, 0, &irc_protocol_cb_438 },
{ "441", /* user not in channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "442", /* not on channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "443", /* user already on channel */ 1, 0, &irc_protocol_cb_generic_error },
{ "444", /* user not logged in */ 1, 0, &irc_protocol_cb_generic_error },
{ "445", /* summon has been disabled */ 1, 0, &irc_protocol_cb_generic_error },
{ "446", /* users has been disabled */ 1, 0, &irc_protocol_cb_generic_error },
{ "451", /* you are not registered */ 1, 0, &irc_protocol_cb_generic_error },
{ "461", /* not enough parameters */ 1, 0, &irc_protocol_cb_generic_error },
{ "462", /* you may not register */ 1, 0, &irc_protocol_cb_generic_error },
{ "463", /* your host isn't among the privileged */ 1, 0, &irc_protocol_cb_generic_error },
{ "464", /* password incorrect */ 1, 0, &irc_protocol_cb_generic_error },
{ "465", /* you are banned from this server */ 1, 0, &irc_protocol_cb_generic_error },
{ "467", /* channel key already set */ 1, 0, &irc_protocol_cb_generic_error },
{ "470", /* forwarding to another channel */ 1, 0, &irc_protocol_cb_470 },
{ "471", /* channel is already full */ 1, 0, &irc_protocol_cb_generic_error },
{ "472", /* unknown mode char to me */ 1, 0, &irc_protocol_cb_generic_error },
{ "473", /* cannot join channel (invite only) */ 1, 0, &irc_protocol_cb_generic_error },
{ "474", /* cannot join channel (banned from channel) */ 1, 0, &irc_protocol_cb_generic_error },
{ "475", /* cannot join channel (bad channel key) */ 1, 0, &irc_protocol_cb_generic_error },
{ "476", /* bad channel mask */ 1, 0, &irc_protocol_cb_generic_error },
{ "477", /* channel doesn't support modes */ 1, 0, &irc_protocol_cb_generic_error },
{ "481", /* you're not an IRC operator */ 1, 0, &irc_protocol_cb_generic_error },
{ "482", /* you're not channel operator */ 1, 0, &irc_protocol_cb_generic_error },
{ "483", /* you can't kill a server! */ 1, 0, &irc_protocol_cb_generic_error },
{ "484", /* your connection is restricted! */ 1, 0, &irc_protocol_cb_generic_error },
{ "485", /* user is immune from kick/deop */ 1, 0, &irc_protocol_cb_generic_error },
{ "487", /* network split */ 1, 0, &irc_protocol_cb_generic_error },
{ "491", /* no O-lines for your host */ 1, 0, &irc_protocol_cb_generic_error },
{ "501", /* unknown mode flag */ 1, 0, &irc_protocol_cb_generic_error },
{ "502", /* can't change mode for other users */ 1, 0, &irc_protocol_cb_generic_error },
{ "671", /* whois (secure connection) */ 1, 0, &irc_protocol_cb_whois_nick_msg },
{ "728", /* quietlist */ 1, 0, &irc_protocol_cb_728 },
{ "729", /* end of quietlist */ 1, 0, &irc_protocol_cb_729 },
{ "730", /* monitored nicks online */ 1, 0, &irc_protocol_cb_730 },
{ "731", /* monitored nicks offline */ 1, 0, &irc_protocol_cb_731 },
{ "732", /* list of monitored nicks */ 1, 0, &irc_protocol_cb_732 },
{ "733", /* end of monitor list */ 1, 0, &irc_protocol_cb_733 },
{ "734", /* monitor list is full */ 1, 0, &irc_protocol_cb_734 },
{ "900", /* logged in as (SASL) */ 1, 0, &irc_protocol_cb_900 },
{ "901", /* you are now logged in */ 1, 0, &irc_protocol_cb_901 },
{ "902", /* SASL authentication failed (account locked/held) */ 1, 0, &irc_protocol_cb_sasl_end_fail },
{ "903", /* SASL authentication successful */ 1, 0, &irc_protocol_cb_sasl_end_ok },
{ "904", /* SASL authentication failed */ 1, 0, &irc_protocol_cb_sasl_end_fail },
{ "905", /* SASL message too long */ 1, 0, &irc_protocol_cb_sasl_end_fail },
{ "906", /* SASL authentication aborted */ 1, 0, &irc_protocol_cb_sasl_end_fail },
{ "907", /* You have already completed SASL authentication */ 1, 0, &irc_protocol_cb_sasl_end_ok },
{ "936", /* censored word */ 1, 0, &irc_protocol_cb_generic_error },
{ "973", /* whois (secure connection) */ 1, 0, &irc_protocol_cb_server_mode_reason },
{ "974", /* whois (secure connection) */ 1, 0, &irc_protocol_cb_server_mode_reason },
{ "975", /* whois (secure connection) */ 1, 0, &irc_protocol_cb_server_mode_reason },
{ NULL, 0, 0, NULL }
};
if (!msg_command)
return;
message_colors_decoded = NULL;
argv = NULL;
argv_eol = NULL;
hash_tags = NULL;
date = 0;
ptr_msg_after_tags = irc_message;
/* get tags as hashtable */
if (irc_message && (irc_message[0] == '@'))
{
pos_space = strchr (irc_message, ' ');
if (pos_space)
{
tags = weechat_strndup (irc_message + 1,
pos_space - (irc_message + 1));
if (tags)
{
hash_tags = irc_protocol_get_message_tags (tags);
if (hash_tags)
{
date = irc_protocol_parse_time (
weechat_hashtable_get (hash_tags, "time"));
}
free (tags);
}
ptr_msg_after_tags = pos_space;
while (ptr_msg_after_tags[0] == ' ')
{
ptr_msg_after_tags++;
}
}
else
ptr_msg_after_tags = NULL;
}
/* get nick/host/address from IRC message */
nick1 = NULL;
address1 = NULL;
host1 = NULL;
if (ptr_msg_after_tags && (ptr_msg_after_tags[0] == ':'))
{
nick1 = irc_message_get_nick_from_host (ptr_msg_after_tags);
address1 = irc_message_get_address_from_host (ptr_msg_after_tags);
host1 = ptr_msg_after_tags + 1;
}
nick = (nick1) ? strdup (nick1) : NULL;
address = (address1) ? strdup (address1) : NULL;
address_color = (address) ?
irc_color_decode (
address,
weechat_config_boolean (irc_config_network_colors_receive)) :
NULL;
host = (host1) ? strdup (host1) : NULL;
if (host)
{
pos_space = strchr (host, ' ');
if (pos_space)
pos_space[0] = '\0';
}
host_no_color = (host) ? irc_color_decode (host, 0) : NULL;
host_color = (host) ?
irc_color_decode (
host,
weechat_config_boolean (irc_config_network_colors_receive)) :
NULL;
/* check if message is ignored or not */
ptr_channel = NULL;
if (msg_channel)
ptr_channel = irc_channel_search (server, msg_channel);
message_ignored = irc_ignore_check (
server,
(ptr_channel) ? ptr_channel->name : msg_channel,
nick, host_no_color);
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in", msg_command,
irc_message, NULL);
/* send signal with received command, only if message is not ignored */
if (!message_ignored)
{
irc_server_send_signal (server, "irc_in", msg_command,
irc_message, NULL);
}
/* look for IRC command */
cmd_found = -1;
for (i = 0; irc_protocol_messages[i].name; i++)
{
if (weechat_strcasecmp (irc_protocol_messages[i].name,
msg_command) == 0)
{
cmd_found = i;
break;
}
}
/* command not found */
if (cmd_found < 0)
{
/* for numeric commands, we use default recv function */
if (irc_protocol_is_numeric_command (msg_command))
{
cmd_name = msg_command;
decode_color = 1;
keep_trailing_spaces = 0;
cmd_recv_func = irc_protocol_cb_numeric;
}
else
{
weechat_printf (server->buffer,
_("%s%s: command \"%s\" not found:"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
msg_command);
weechat_printf (server->buffer,
"%s%s",
weechat_prefix ("error"), irc_message);
goto end;
}
}
else
{
cmd_name = irc_protocol_messages[cmd_found].name;
decode_color = irc_protocol_messages[cmd_found].decode_color;
keep_trailing_spaces = irc_protocol_messages[cmd_found].keep_trailing_spaces;
cmd_recv_func = irc_protocol_messages[cmd_found].recv_function;
}
if (cmd_recv_func != NULL)
{
if (ptr_msg_after_tags)
{
if (decode_color)
{
message_colors_decoded = irc_color_decode (
ptr_msg_after_tags,
weechat_config_boolean (irc_config_network_colors_receive));
}
else
{
message_colors_decoded = strdup (ptr_msg_after_tags);
}
}
else
message_colors_decoded = NULL;
argv = weechat_string_split (message_colors_decoded, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL;
if (keep_trailing_spaces)
flags |= WEECHAT_STRING_SPLIT_STRIP_RIGHT;
argv_eol = weechat_string_split (message_colors_decoded, " ", NULL,
flags, 0, NULL);
return_code = (int) (cmd_recv_func) (server,
date, nick, address_color,
host_color, cmd_name,
message_ignored, argc, argv,
argv_eol);
if (return_code == WEECHAT_RC_ERROR)
{
weechat_printf (server->buffer,
_("%s%s: failed to parse command \"%s\" (please "
"report to developers):"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
msg_command);
weechat_printf (server->buffer,
"%s%s",
weechat_prefix ("error"), irc_message);
}
/* send signal with received command (if message is not ignored) */
if (!message_ignored)
{
irc_server_send_signal (server, "irc_in2", msg_command,
irc_message, NULL);
}
}
/* send signal with received command, even if command is ignored */
irc_server_send_signal (server, "irc_raw_in2", msg_command,
irc_message, NULL);
end:
if (nick)
free (nick);
if (address)
free (address);
if (address_color)
free (address_color);
if (host)
free (host);
if (host_no_color)
free (host_no_color);
if (host_color)
free (host_color);
if (message_colors_decoded)
free (message_colors_decoded);
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
if (hash_tags)
weechat_hashtable_free (hash_tags);
}
| 0
|
340,513
|
CPUMIPSState *cpu_mips_init (const char *cpu_model)
{
CPUMIPSState *env;
const mips_def_t *def;
def = cpu_mips_find_by_name(cpu_model);
if (!def)
return NULL;
env = qemu_mallocz(sizeof(CPUMIPSState));
env->cpu_model = def;
cpu_exec_init(env);
env->cpu_model_str = cpu_model;
mips_tcg_init();
cpu_reset(env);
qemu_init_vcpu(env);
return env;
}
| 1
|
304,949
|
void flushRequestsAndLoopN(uint64_t n,
bool eof=false, milliseconds eofDelay=milliseconds(0),
milliseconds initialDelay=milliseconds(0),
std::function<void()> extraEventsFn = std::function<void()>()) {
flushRequests(eof, eofDelay, initialDelay, extraEventsFn);
for (uint64_t i = 0; i < n; i++) {
eventBase_.loopOnce();
}
}
| 0
|
162,903
|
std::unique_ptr<TracedValue> InspectorPaintImageEvent::Data(
const LayoutImage& layout_image,
const FloatRect& src_rect,
const FloatRect& dest_rect) {
std::unique_ptr<TracedValue> value = TracedValue::Create();
SetGeneratingNodeInfo(value.get(), &layout_image, "nodeId");
if (const ImageResourceContent* resource = layout_image.CachedImage())
value->SetString("url", resource->Url().GetString());
value->SetInteger("x", dest_rect.X());
value->SetInteger("y", dest_rect.Y());
value->SetInteger("width", dest_rect.Width());
value->SetInteger("height", dest_rect.Height());
value->SetInteger("srcWidth", src_rect.Width());
value->SetInteger("srcHeight", src_rect.Height());
return value;
}
| 0
|
238,738
|
void RenderFrameHostManager::SetRWHViewForInnerContents(
RenderWidgetHostView* child_rwhv) {
DCHECK(ForInnerDelegate() && frame_tree_node_->IsMainFrame());
GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv, nullptr);
}
| 0
|
80,771
|
void t2p_free(T2P* t2p)
{
int i = 0;
if (t2p != NULL) {
if(t2p->pdf_xrefoffsets != NULL){
_TIFFfree( (tdata_t) t2p->pdf_xrefoffsets);
}
if(t2p->tiff_pages != NULL){
_TIFFfree( (tdata_t) t2p->tiff_pages);
}
for(i=0;i<t2p->tiff_pagecount;i++){
if(t2p->tiff_tiles[i].tiles_tiles != NULL){
_TIFFfree( (tdata_t) t2p->tiff_tiles[i].tiles_tiles);
}
}
if(t2p->tiff_tiles != NULL){
_TIFFfree( (tdata_t) t2p->tiff_tiles);
}
if(t2p->pdf_palette != NULL){
_TIFFfree( (tdata_t) t2p->pdf_palette);
}
#ifdef OJPEG_SUPPORT
if(t2p->pdf_ojpegdata != NULL){
_TIFFfree( (tdata_t) t2p->pdf_ojpegdata);
}
#endif
_TIFFfree( (tdata_t) t2p );
}
return;
}
| 0
|
139,286
|
int jffs2_init_acl_post(struct inode *inode)
{
int rc;
if (inode->i_default_acl) {
rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_DEFAULT, inode->i_default_acl);
if (rc)
return rc;
}
if (inode->i_acl) {
rc = __jffs2_set_acl(inode, JFFS2_XPREFIX_ACL_ACCESS, inode->i_acl);
if (rc)
return rc;
}
return 0;
}
| 0
|
6,420
|
bool read_ujpg( void )
{
using namespace IOUtil;
using namespace Sirikata;
// colldata.start_decoder_worker_thread(std::bind(&simple_decoder, &colldata, str_in));
unsigned char ujpg_mrk[ 64 ];
// this is where we will enable seccomp, before reading user data
write_byte_bill(Billing::HEADER, true, 24); // for the fixed header
str_out->call_size_callback(max_file_size);
uint32_t compressed_header_size = 0;
if (ReadFull(str_in, ujpg_mrk, 4) != 4) {
custom_exit(ExitCode::SHORT_READ);
}
write_byte_bill(Billing::HEADER, true, 4);
compressed_header_size = LEtoUint32(ujpg_mrk);
if (compressed_header_size > 128 * 1024 * 1024 || max_file_size > 128 * 1024 * 1024) {
always_assert(false && "Only support images < 128 megs");
return false; // bool too big
}
bool pending_header_reads = false;
if (header_reader == NULL) {
std::vector<uint8_t, JpegAllocator<uint8_t> > compressed_header_buffer(compressed_header_size);
IOUtil::ReadFull(str_in, compressed_header_buffer.data(), compressed_header_buffer.size());
header_reader = new MemReadWriter((JpegAllocator<uint8_t>()));
{
if (ujgversion == 1) {
JpegAllocator<uint8_t> no_free_allocator;
#if !defined(USE_STANDARD_MEMORY_ALLOCATORS) && !defined(_WIN32) && !defined(EMSCRIPTEN)
no_free_allocator.setup_memory_subsystem(32 * 1024 * 1024,
16,
&mem_init_nop,
&MemMgrAllocatorMalloc,
&mem_nop,
&mem_realloc_nop,
&MemMgrAllocatorMsize);
#endif
std::pair<std::vector<uint8_t,
Sirikata::JpegAllocator<uint8_t> >,
JpegError> uncompressed_header_buffer(
ZlibDecoderDecompressionReader::Decompress(compressed_header_buffer.data(),
compressed_header_buffer.size(),
no_free_allocator,
max_file_size + 2048));
if (uncompressed_header_buffer.second) {
always_assert(false && "Data not properly zlib coded");
return false;
}
zlib_hdrs = compressed_header_buffer.size();
header_reader->SwapIn(uncompressed_header_buffer.first, 0);
} else {
std::pair<std::vector<uint8_t,
Sirikata::JpegAllocator<uint8_t> >,
JpegError> uncompressed_header_buffer(
Sirikata::BrotliCodec::Decompress(compressed_header_buffer.data(),
compressed_header_buffer.size(),
JpegAllocator<uint8_t>(),
max_file_size * 2 + 128 * 1024 * 1024));
if (uncompressed_header_buffer.second) {
always_assert(false && "Data not properly zlib coded");
return false;
}
zlib_hdrs = compressed_header_buffer.size();
header_reader->SwapIn(uncompressed_header_buffer.first, 0);
}
}
write_byte_bill(Billing::HEADER,
true,
compressed_header_buffer.size());
} else {
always_assert(compressed_header_size == 0 && "Special concatenation requires 0 size header");
}
grbs = sizeof(EOI);
grbgdata = EOI; // if we don't have any garbage, assume FFD9 EOI
// read header from file
ReadFull(header_reader, ujpg_mrk, 3 ) ;
// check marker
if ( memcmp( ujpg_mrk, "HDR", 3 ) == 0 ) {
// read size of header, alloc memory
ReadFull(header_reader, ujpg_mrk, 4 );
hdrs = LEtoUint32(ujpg_mrk);
hdrdata = (unsigned char*) aligned_alloc(hdrs);
memset(hdrdata, 0, hdrs);
if ( hdrdata == NULL ) {
fprintf( stderr, MEM_ERRMSG );
errorlevel.store(2);
return false;
}
// read hdrdata
ReadFull(header_reader, hdrdata, hdrs );
}
else {
fprintf( stderr, "HDR marker not found" );
errorlevel.store(2);
return false;
}
bool memory_optimized_image = (filetype != UJG) && !g_allow_progressive;
// parse header for image-info
if ( !setup_imginfo_jpg(memory_optimized_image) )
return false;
// beginning here: recovery information (needed for exact JPEG recovery)
// read padbit information from file
ReadFull(header_reader, ujpg_mrk, 3 );
// check marker
if ( memcmp( ujpg_mrk, "P0D", 3 ) == 0 ) {
// This is a more nuanced pad byte that can have different values per bit
header_reader->Read( reinterpret_cast<unsigned char*>(&padbit), 1 );
}
else if ( memcmp( ujpg_mrk, "PAD", 3 ) == 0 ) {
// this is a single pad bit that is implied to have all the same values
header_reader->Read( reinterpret_cast<unsigned char*>(&padbit), 1 );
if (!(padbit == 0 || padbit == 1 ||padbit == -1)) {
while (write(2,
"Legacy Padbit must be 0, 1 or -1\n",
strlen("Legacy Padbit must be 0, 1 or -1\n")) < 0
&& errno == EINTR) {
}
custom_exit(ExitCode::STREAM_INCONSISTENT);
}
if (padbit == 1) {
padbit = 0x7f; // all 6 bits set
}
}
else {
fprintf( stderr, "PAD marker not found" );
errorlevel.store(2);
return false;
}
std::vector<ThreadHandoff> thread_handoff;
// read further recovery information if any
while ( ReadFull(header_reader, ujpg_mrk, 3 ) == 3 ) {
// check marker
if ( memcmp( ujpg_mrk, "CRS", 3 ) == 0 ) {
rst_cnt_set = true;
ReadFull(header_reader, ujpg_mrk, 4);
rst_cnt.resize(LEtoUint32(ujpg_mrk));
for (size_t i = 0; i < rst_cnt.size(); ++i) {
ReadFull(header_reader, ujpg_mrk, 4);
rst_cnt.at(i) = LEtoUint32(ujpg_mrk);
}
} else if ( memcmp( ujpg_mrk, "HHX", 2 ) == 0 ) { // only look at first two bytes
size_t to_alloc = ThreadHandoff::get_remaining_data_size_from_two_bytes(ujpg_mrk + 1) + 2;
if(to_alloc) {
std::vector<unsigned char> data(to_alloc);
data[0] = ujpg_mrk[1];
data[1] = ujpg_mrk[2];
ReadFull(header_reader, &data[2], to_alloc - 2);
thread_handoff = ThreadHandoff::deserialize(&data[0], to_alloc);
}
} else if ( memcmp( ujpg_mrk, "FRS", 3 ) == 0 ) {
// read number of false set RST markers per scan from file
ReadFull(header_reader, ujpg_mrk, 4);
scnc = LEtoUint32(ujpg_mrk);
rst_err.insert(rst_err.end(), scnc - rst_err.size(), 0);
// read data
ReadFull(header_reader, rst_err.data(), scnc );
}
else if ( memcmp( ujpg_mrk, "GRB", 3 ) == 0 ) {
// read garbage (data after end of JPG) from file
ReadFull(header_reader, ujpg_mrk, 4);
grbs = LEtoUint32(ujpg_mrk);
grbgdata = aligned_alloc(grbs);
memset(grbgdata, 0, sizeof(grbs));
if ( grbgdata == NULL ) {
fprintf( stderr, MEM_ERRMSG );
errorlevel.store(2);
return false;
}
// read garbage data
ReadFull(header_reader, grbgdata, grbs );
}
else if ( memcmp( ujpg_mrk, "PGR", 3 ) == 0 || memcmp( ujpg_mrk, "PGE", 3 ) == 0 ) {
// read prefix garbage (data before beginning of JPG) from file
if (ujpg_mrk[2] == 'E') {
// embedded jpeg: full header required
embedded_jpeg = true;
}
ReadFull(header_reader, ujpg_mrk, 4);
prefix_grbs = LEtoUint32(ujpg_mrk);
prefix_grbgdata = aligned_alloc(prefix_grbs);
memset(prefix_grbgdata, 0, sizeof(prefix_grbs));
if ( prefix_grbgdata == NULL ) {
fprintf( stderr, MEM_ERRMSG );
errorlevel.store(2);
return false;
}
// read garbage data
ReadFull(header_reader, prefix_grbgdata, prefix_grbs );
}
else if ( memcmp( ujpg_mrk, "SIZ", 3 ) == 0 ) {
// full size of the original file
ReadFull(header_reader, ujpg_mrk, 4);
max_file_size = LEtoUint32(ujpg_mrk);
}
else if ( memcmp( ujpg_mrk, "EEE", 3) == 0) {
ReadFull(header_reader, ujpg_mrk, 28);
max_cmp = LEtoUint32(ujpg_mrk);
max_bpos = LEtoUint32(ujpg_mrk + 4);
max_sah = LEtoUint32(ujpg_mrk + 8);
max_dpos[0] = LEtoUint32(ujpg_mrk + 12);
max_dpos[1] = LEtoUint32(ujpg_mrk + 16);
max_dpos[2] = LEtoUint32(ujpg_mrk + 20);
max_dpos[3] = LEtoUint32(ujpg_mrk + 24);
early_eof_encountered = true;
colldata.set_truncation_bounds(max_cmp, max_bpos, max_dpos, max_sah);
}
else {
if (memcmp(ujpg_mrk, "CNT", 3) == 0 ) {
pending_header_reads = true;
break;
} else if (memcmp(ujpg_mrk, "CMP", 3) == 0 ) {
break;
} else {
fprintf( stderr, "unknown data found" );
errorlevel.store(2);
}
return false;
}
}
if (!pending_header_reads) {
delete header_reader;
header_reader = NULL;
}
write_byte_bill(Billing::HEADER,
false,
2 + hdrs + prefix_grbs + grbs);
ReadFull(str_in, ujpg_mrk, 3 ) ;
write_byte_bill(Billing::HEADER, true, 3);
write_byte_bill(Billing::DELIMITERS, true, 4 * NUM_THREADS); // trailing vpx_encode bits
write_byte_bill(Billing::HEADER, true, 4); //trailing size
if (memcmp(ujpg_mrk, "CMP", 3) != 0) {
always_assert(false && "CMP must be present (uncompressed) in the file or CNT continue marker");
return false; // not a JPG
}
colldata.signal_worker_should_begin();
g_decoder->initialize(str_in, thread_handoff);
colldata.start_decoder(g_decoder);
return true;
}
| 1
|
260,326
|
void check_ndpi_udp_flow_func(struct ndpi_detection_module_struct *ndpi_str, struct ndpi_flow_struct *flow,
NDPI_SELECTION_BITMASK_PROTOCOL_SIZE *ndpi_selection_packet) {
void *func = NULL;
u_int32_t a;
u_int16_t proto_index = ndpi_str->proto_defaults[flow->guessed_protocol_id].protoIdx;
int16_t proto_id = ndpi_str->proto_defaults[flow->guessed_protocol_id].protoId;
NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_SAVE_AS_BITMASK(detection_bitmask, flow->packet.detected_protocol_stack[0]);
if((proto_id != NDPI_PROTOCOL_UNKNOWN) &&
NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
ndpi_str->callback_buffer[proto_index].excluded_protocol_bitmask) == 0 &&
NDPI_BITMASK_COMPARE(ndpi_str->callback_buffer[proto_index].detection_bitmask, detection_bitmask) != 0 &&
(ndpi_str->callback_buffer[proto_index].ndpi_selection_bitmask & *ndpi_selection_packet) ==
ndpi_str->callback_buffer[proto_index].ndpi_selection_bitmask) {
if((flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN) &&
(ndpi_str->proto_defaults[flow->guessed_protocol_id].func != NULL))
ndpi_str->proto_defaults[flow->guessed_protocol_id].func(ndpi_str, flow),
func = ndpi_str->proto_defaults[flow->guessed_protocol_id].func;
}
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
for (a = 0; a < ndpi_str->callback_buffer_size_udp; a++) {
if((func != ndpi_str->callback_buffer_udp[a].func) &&
(ndpi_str->callback_buffer_udp[a].ndpi_selection_bitmask & *ndpi_selection_packet) ==
ndpi_str->callback_buffer_udp[a].ndpi_selection_bitmask &&
NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
ndpi_str->callback_buffer_udp[a].excluded_protocol_bitmask) == 0 &&
NDPI_BITMASK_COMPARE(ndpi_str->callback_buffer_udp[a].detection_bitmask, detection_bitmask) != 0) {
ndpi_str->callback_buffer_udp[a].func(ndpi_str, flow);
// NDPI_LOG_DBG(ndpi_str, "[UDP,CALL] dissector of protocol as callback_buffer idx = %d\n",a);
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
break; /* Stop after detecting the first protocol */
} else if(_ndpi_debug_callbacks)
NDPI_LOG_DBG2(ndpi_str, "[UDP,SKIP] dissector of protocol as callback_buffer idx = %d\n", a);
}
}
}
| 0
|
498,501
|
TEST_F(RouterTest, RetryUpstreamReset) {
NiceMock<Http::MockRequestEncoder> encoder1;
Http::ResponseDecoder* response_decoder = nullptr;
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_, newStream(_, _))
.WillOnce(Invoke(
[&](Http::ResponseDecoder& decoder,
Http::ConnectionPool::Callbacks& callbacks) -> Http::ConnectionPool::Cancellable* {
response_decoder = &decoder;
callbacks.onPoolReady(encoder1, cm_.thread_local_cluster_.conn_pool_.host_,
upstream_stream_info_, Http::Protocol::Http10);
return nullptr;
}));
expectResponseTimerCreate();
Http::TestRequestHeaderMapImpl headers{{"x-envoy-retry-on", "5xx"}, {"x-envoy-internal", "true"}};
HttpTestUtility::addDefaultHeaders(headers);
router_.decodeHeaders(headers, false);
EXPECT_CALL(*router_.retry_state_, enabled()).WillOnce(Return(true));
EXPECT_CALL(callbacks_, addDecodedData(_, _));
Buffer::OwnedImpl body("test body");
router_.decodeData(body, true);
EXPECT_EQ(1U,
callbacks_.route_->route_entry_.virtual_cluster_.stats().upstream_rq_total_.value());
router_.retry_state_->expectResetRetry();
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_.host_->outlier_detector_,
putResult(Upstream::Outlier::Result::LocalOriginConnectFailed, _));
encoder1.stream_.resetStream(Http::StreamResetReason::RemoteReset);
// We expect this reset to kick off a new request.
NiceMock<Http::MockRequestEncoder> encoder2;
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_, newStream(_, _))
.WillOnce(Invoke(
[&](Http::ResponseDecoder& decoder,
Http::ConnectionPool::Callbacks& callbacks) -> Http::ConnectionPool::Cancellable* {
response_decoder = &decoder;
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_.host_->outlier_detector_,
putResult(Upstream::Outlier::Result::LocalOriginConnectSuccess,
absl::optional<uint64_t>(absl::nullopt)));
callbacks.onPoolReady(encoder2, cm_.thread_local_cluster_.conn_pool_.host_,
upstream_stream_info_, Http::Protocol::Http10);
return nullptr;
}));
router_.retry_state_->callback_();
EXPECT_EQ(2U,
callbacks_.route_->route_entry_.virtual_cluster_.stats().upstream_rq_total_.value());
EXPECT_TRUE(verifyHostUpstreamStats(0, 1));
// Normal response.
EXPECT_CALL(*router_.retry_state_, shouldRetryHeaders(_, _)).WillOnce(Return(RetryStatus::No));
Http::ResponseHeaderMapPtr response_headers(
new Http::TestResponseHeaderMapImpl{{":status", "200"}});
EXPECT_CALL(cm_.thread_local_cluster_.conn_pool_.host_->outlier_detector_,
putHttpResponseCode(200));
response_decoder->decodeHeaders(std::move(response_headers), true);
EXPECT_TRUE(verifyHostUpstreamStats(1, 1));
}
| 0
|
508,450
|
int SSL_state(const SSL *ssl)
{
return (ssl->state);
}
| 0
|
257,258
|
static int calc_slice_sizes ( VC2EncContext * s ) {
int i , j , slice_x , slice_y , bytes_left = 0 ;
int bytes_top [ SLICE_REDIST_TOTAL ] = {
0 }
;
int64_t total_bytes_needed = 0 ;
int slice_redist_range = FFMIN ( SLICE_REDIST_TOTAL , s -> num_x * s -> num_y ) ;
SliceArgs * enc_args = s -> slice_args ;
SliceArgs * top_loc [ SLICE_REDIST_TOTAL ] = {
NULL }
;
init_quant_matrix ( s ) ;
for ( slice_y = 0 ;
slice_y < s -> num_y ;
slice_y ++ ) {
for ( slice_x = 0 ;
slice_x < s -> num_x ;
slice_x ++ ) {
SliceArgs * args = & enc_args [ s -> num_x * slice_y + slice_x ] ;
args -> ctx = s ;
args -> x = slice_x ;
args -> y = slice_y ;
args -> bits_ceil = s -> slice_max_bytes << 3 ;
args -> bits_floor = s -> slice_min_bytes << 3 ;
memset ( args -> cache , 0 , s -> q_ceil * sizeof ( * args -> cache ) ) ;
}
}
s -> avctx -> execute ( s -> avctx , rate_control , enc_args , NULL , s -> num_x * s -> num_y , sizeof ( SliceArgs ) ) ;
for ( i = 0 ;
i < s -> num_x * s -> num_y ;
i ++ ) {
SliceArgs * args = & enc_args [ i ] ;
bytes_left += s -> slice_max_bytes - args -> bytes ;
for ( j = 0 ;
j < slice_redist_range ;
j ++ ) {
if ( args -> bytes > bytes_top [ j ] ) {
bytes_top [ j ] = args -> bytes ;
top_loc [ j ] = args ;
break ;
}
}
}
while ( 1 ) {
int distributed = 0 ;
for ( i = 0 ;
i < slice_redist_range ;
i ++ ) {
SliceArgs * args ;
int bits , bytes , diff , prev_bytes , new_idx ;
if ( bytes_left <= 0 ) break ;
if ( ! top_loc [ i ] || ! top_loc [ i ] -> quant_idx ) break ;
args = top_loc [ i ] ;
prev_bytes = args -> bytes ;
new_idx = FFMAX ( args -> quant_idx - 1 , 0 ) ;
bits = count_hq_slice ( args , new_idx ) ;
bytes = SSIZE_ROUND ( bits >> 3 ) ;
diff = bytes - prev_bytes ;
if ( ( bytes_left - diff ) > 0 ) {
args -> quant_idx = new_idx ;
args -> bytes = bytes ;
bytes_left -= diff ;
distributed ++ ;
}
}
if ( ! distributed ) break ;
}
for ( i = 0 ;
i < s -> num_x * s -> num_y ;
i ++ ) {
SliceArgs * args = & enc_args [ i ] ;
total_bytes_needed += args -> bytes ;
s -> q_avg = ( s -> q_avg + args -> quant_idx ) / 2 ;
}
return total_bytes_needed ;
}
| 0
|
216,921
|
void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResultForVideo(
base::WeakPtr<RenderWidgetHostViewAura> rwhva,
scoped_refptr<OwnedMailbox> subscriber_texture,
scoped_refptr<media::VideoFrame> video_frame,
const base::Callback<void(bool)>& callback,
scoped_ptr<cc::CopyOutputResult> result) {
base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
base::ScopedClosureRunner scoped_return_subscriber_texture(
base::Bind(&ReturnSubscriberTexture, rwhva, subscriber_texture, 0));
if (!rwhva)
return;
if (result->IsEmpty())
return;
if (result->size().IsEmpty())
return;
gfx::Rect region_in_frame =
media::ComputeLetterboxRegion(gfx::Rect(video_frame->coded_size()),
result->size());
region_in_frame = gfx::Rect(region_in_frame.x() & ~1,
region_in_frame.y() & ~1,
region_in_frame.width() & ~1,
region_in_frame.height() & ~1);
if (region_in_frame.IsEmpty())
return;
if (!result->HasTexture()) {
DCHECK(result->HasBitmap());
scoped_ptr<SkBitmap> bitmap = result->TakeBitmap();
SkBitmap scaled_bitmap;
if (result->size().width() != region_in_frame.width() ||
result->size().height() != region_in_frame.height()) {
skia::ImageOperations::ResizeMethod method =
skia::ImageOperations::RESIZE_GOOD;
scaled_bitmap = skia::ImageOperations::Resize(*bitmap.get(), method,
region_in_frame.width(),
region_in_frame.height());
} else {
scaled_bitmap = *bitmap.get();
}
{
SkAutoLockPixels scaled_bitmap_locker(scaled_bitmap);
media::CopyRGBToVideoFrame(
reinterpret_cast<uint8*>(scaled_bitmap.getPixels()),
scaled_bitmap.rowBytes(),
region_in_frame,
video_frame.get());
}
ignore_result(scoped_callback_runner.Release());
callback.Run(true);
return;
}
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
GLHelper* gl_helper = factory->GetGLHelper();
if (!gl_helper)
return;
if (subscriber_texture.get() && !subscriber_texture->texture_id())
return;
cc::TextureMailbox texture_mailbox;
scoped_ptr<cc::SingleReleaseCallback> release_callback;
result->TakeTexture(&texture_mailbox, &release_callback);
DCHECK(texture_mailbox.IsTexture());
if (!texture_mailbox.IsTexture())
return;
gfx::Rect result_rect(result->size());
content::ReadbackYUVInterface* yuv_readback_pipeline =
rwhva->yuv_readback_pipeline_.get();
if (yuv_readback_pipeline == NULL ||
yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() ||
yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect ||
yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) {
GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST;
std::string quality_switch = switches::kTabCaptureDownscaleQuality;
if (result_rect.size().width() < region_in_frame.size().width() &&
result_rect.size().height() < region_in_frame.size().height())
quality_switch = switches::kTabCaptureUpscaleQuality;
std::string switch_value =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(quality_switch);
if (switch_value == "fast")
quality = GLHelper::SCALER_QUALITY_FAST;
else if (switch_value == "good")
quality = GLHelper::SCALER_QUALITY_GOOD;
else if (switch_value == "best")
quality = GLHelper::SCALER_QUALITY_BEST;
rwhva->yuv_readback_pipeline_.reset(
gl_helper->CreateReadbackPipelineYUV(quality,
result_rect.size(),
result_rect,
video_frame->coded_size(),
region_in_frame,
true,
true));
yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get();
}
ignore_result(scoped_callback_runner.Release());
ignore_result(scoped_return_subscriber_texture.Release());
base::Callback<void(bool result)> finished_callback = base::Bind(
&RenderWidgetHostViewAura::CopyFromCompositingSurfaceFinishedForVideo,
rwhva->AsWeakPtr(),
callback,
subscriber_texture,
base::Passed(&release_callback));
yuv_readback_pipeline->ReadbackYUV(texture_mailbox.mailbox(),
texture_mailbox.sync_point(),
video_frame.get(),
finished_callback);
}
| 0
|
359,398
|
check_mountpoint(const char *progname, char *mountpoint)
{
int err;
struct stat statbuf;
/* does mountpoint exist and is it a directory? */
err = stat(".", &statbuf);
if (err) {
fprintf(stderr, "%s: failed to stat %s: %s\n", progname,
mountpoint, strerror(errno));
return EX_USAGE;
}
if (!S_ISDIR(statbuf.st_mode)) {
fprintf(stderr, "%s: %s is not a directory!", progname,
mountpoint);
return EX_USAGE;
}
#if CIFS_LEGACY_SETUID_CHECK
/* do extra checks on mountpoint for legacy setuid behavior */
if (!getuid() || geteuid())
return 0;
if (statbuf.st_uid != getuid()) {
fprintf(stderr, "%s: %s is not owned by user\n", progname,
mountpoint);
return EX_USAGE;
}
if ((statbuf.st_mode & S_IRWXU) != S_IRWXU) {
fprintf(stderr, "%s: invalid permissions on %s\n", progname,
mountpoint);
return EX_USAGE;
}
#endif /* CIFS_LEGACY_SETUID_CHECK */
return 0;
}
| 0
|
275,191
|
unsigned long SSL_CIPHER_get_id(const SSL_CIPHER* cipher) { return cipher->id; }
| 0
|
138,568
|
static int compat_getdrvstat(int drive, bool poll,
struct compat_floppy_drive_struct __user *arg)
{
struct compat_floppy_drive_struct v;
memset(&v, 0, sizeof(struct compat_floppy_drive_struct));
mutex_lock(&floppy_mutex);
if (poll) {
if (lock_fdc(drive))
goto Eintr;
if (poll_drive(true, FD_RAW_NEED_DISK) == -EINTR)
goto Eintr;
process_fd_request();
}
v.spinup_date = UDRS->spinup_date;
v.select_date = UDRS->select_date;
v.first_read_date = UDRS->first_read_date;
v.probed_format = UDRS->probed_format;
v.track = UDRS->track;
v.maxblock = UDRS->maxblock;
v.maxtrack = UDRS->maxtrack;
v.generation = UDRS->generation;
v.keep_data = UDRS->keep_data;
v.fd_ref = UDRS->fd_ref;
v.fd_device = UDRS->fd_device;
v.last_checked = UDRS->last_checked;
v.dmabuf = (uintptr_t)UDRS->dmabuf;
v.bufblocks = UDRS->bufblocks;
mutex_unlock(&floppy_mutex);
if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_struct)))
return -EFAULT;
return 0;
Eintr:
mutex_unlock(&floppy_mutex);
return -EINTR;
}
| 0
|
155,186
|
static struct sched_domain *__build_book_sched_domain(struct s_data *d,
const struct cpumask *cpu_map, struct sched_domain_attr *attr,
struct sched_domain *parent, int i)
{
struct sched_domain *sd = parent;
#ifdef CONFIG_SCHED_BOOK
sd = &per_cpu(book_domains, i).sd;
SD_INIT(sd, BOOK);
set_domain_attribute(sd, attr);
cpumask_and(sched_domain_span(sd), cpu_map, cpu_book_mask(i));
sd->parent = parent;
parent->child = sd;
cpu_to_book_group(i, cpu_map, &sd->groups, d->tmpmask);
#endif
return sd;
}
| 0
|
152,574
|
static void json_tokener_reset_level(struct json_tokener *tok, int depth)
{
tok->stack[depth].state = json_tokener_state_eatws;
tok->stack[depth].saved_state = json_tokener_state_start;
json_object_put(tok->stack[depth].current);
tok->stack[depth].current = NULL;
free(tok->stack[depth].obj_field_name);
tok->stack[depth].obj_field_name = NULL;
}
| 0
|
119,893
|
static int try_open_file(Jsi_Interp *interp, FileObj *udf, Jsi_Value *args)
{
int ret = JSI_ERROR;
fileObjErase(udf);
// TODO: stdin, stdout, stderr, etc.
Jsi_Value *fname = Jsi_ValueArrayIndex(interp, args, 0);
if (fname && Jsi_ValueIsString(interp, fname)) {
Jsi_Value *vmode = Jsi_ValueArrayIndex(interp, args, 1);
const char *mode = NULL;
const char *fstr = Jsi_ValueString(interp, fname, NULL);
if (vmode && Jsi_ValueIsString(interp,vmode)) {
mode = Jsi_ValueString(interp, vmode, NULL);
}
int writ = (mode && (Jsi_Strchr(mode,'w')||Jsi_Strchr(mode,'+')));
int aflag = (writ ? JSI_INTACCESS_WRITE : JSI_INTACCESS_READ);
if (interp->isSafe && Jsi_InterpAccess(interp, fname, aflag) != JSI_OK)
return Jsi_LogError("Safe open failed");
char *rmode = Jsi_Strdup(mode ? mode : "r");
Jsi_Channel chan = Jsi_Open(interp, fname, rmode);
if (chan) {
udf->chan = chan;
udf->fname = fname;
udf->interp = interp;
Jsi_IncrRefCount(interp, fname);
udf->filename = Jsi_Strdup(fstr);
udf->mode = Jsi_Strdup(rmode);
ret = JSI_OK;
}
Jsi_Free(rmode);
}
return ret;
}
| 0
|
175,564
|
bool InputMethodIBus::DispatchKeyEvent(const base::NativeEvent& native_event) {
DCHECK(native_event && (native_event->type == KeyPress ||
native_event->type == KeyRelease));
DCHECK(system_toplevel_window_focused());
uint32 ibus_keyval = 0;
uint32 ibus_keycode = 0;
uint32 ibus_state = 0;
IBusKeyEventFromNativeKeyEvent(
native_event,
&ibus_keyval, &ibus_keycode, &ibus_state);
if (!context_focused_ || !GetEngine() ||
GetTextInputType() == TEXT_INPUT_TYPE_PASSWORD ) {
if (native_event->type == KeyPress) {
if (ExecuteCharacterComposer(ibus_keyval, ibus_keycode, ibus_state)) {
ProcessKeyEventPostIME(native_event, ibus_state, true);
return true;
}
ProcessUnfilteredKeyPressEvent(native_event, ibus_state);
} else {
DispatchKeyEventPostIME(native_event);
}
return true;
}
pending_key_events_.insert(current_keyevent_id_);
XEvent* event = new XEvent;
*event = *native_event;
GetEngine()->ProcessKeyEvent(
ibus_keyval,
ibus_keycode,
ibus_state,
base::Bind(&InputMethodIBus::ProcessKeyEventDone,
weak_ptr_factory_.GetWeakPtr(),
current_keyevent_id_,
base::Owned(event), // Pass the ownership of |event|.
ibus_keyval,
ibus_keycode,
ibus_state));
++current_keyevent_id_;
suppress_next_result_ = false;
return true;
}
| 0
|
225,125
|
gchar* webkit_web_view_get_selected_text(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
return g_strdup(frame->editor()->selectedText().utf8().data());
}
| 0
|
417,042
|
ofputil_encode_port_status(const struct ofputil_port_status *ps,
enum ofputil_protocol protocol)
{
struct ofp_port_status *ops;
struct ofpbuf *b;
enum ofp_version version;
enum ofpraw raw;
version = ofputil_protocol_to_ofp_version(protocol);
switch (version) {
case OFP10_VERSION:
raw = OFPRAW_OFPT10_PORT_STATUS;
break;
case OFP11_VERSION:
case OFP12_VERSION:
case OFP13_VERSION:
raw = OFPRAW_OFPT11_PORT_STATUS;
break;
case OFP14_VERSION:
case OFP15_VERSION:
case OFP16_VERSION:
raw = OFPRAW_OFPT14_PORT_STATUS;
break;
default:
OVS_NOT_REACHED();
}
b = ofpraw_alloc_xid(raw, version, htonl(0), 0);
ops = ofpbuf_put_zeros(b, sizeof *ops);
ops->reason = ps->reason;
ofputil_put_phy_port(version, &ps->desc, b);
ofpmsg_update_length(b);
return b;
}
| 0
|
186,484
|
void InspectorResourceAgent::didReceiveData(LocalFrame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength)
{
String requestId = IdentifiersFactory::requestId(identifier);
if (data) {
NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId);
if (resourceData && (!resourceData->cachedResource() || resourceData->cachedResource()->dataBufferingPolicy() == DoNotBufferData || isErrorStatusCode(resourceData->httpStatusCode())))
m_resourcesData->maybeAddResourceData(requestId, data, dataLength);
}
m_frontend->dataReceived(requestId, currentTime(), dataLength, encodedDataLength);
}
| 0
|
235,246
|
gfx::SelectionBound GetSelectionBoundFromRect(const gfx::Rect& rect) {
gfx::SelectionBound bound;
bound.SetEdge(gfx::PointF(rect.origin()), gfx::PointF(rect.bottom_left()));
return bound;
}
| 0
|
449,106
|
check_socket_flag(int sock_flag, int fd_flag, int fs_flag)
{
int sock_fd, fd_flags, fs_flags;
sock_fd = socket(AF_INET, SOCK_DGRAM | sock_flag, 0);
if (sock_fd < 0)
return 0;
fd_flags = fcntl(sock_fd, F_GETFD);
fs_flags = fcntl(sock_fd, F_GETFL);
close(sock_fd);
if (fd_flags == -1 || (fd_flags & fd_flag) != fd_flag ||
fs_flags == -1 || (fs_flags & fs_flag) != fs_flag)
return 0;
return 1;
}
| 0
|
293,226
|
static gboolean property_exists_modalias(const GDBusPropertyTable *property,
void *user_data)
{
struct btd_adapter *adapter = user_data;
return adapter->modalias ? TRUE : FALSE;
}
| 0
|
485,840
|
sctp_disposition_t sctp_sf_operr_notify(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *chunk = arg;
struct sctp_ulpevent *ev;
if (!sctp_vtag_verify(chunk, asoc))
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
/* Make sure that the ERROR chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_operr_chunk_t)))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
while (chunk->chunk_end > chunk->skb->data) {
ev = sctp_ulpevent_make_remote_error(asoc, chunk, 0,
GFP_ATOMIC);
if (!ev)
goto nomem;
if (!sctp_add_cmd(commands, SCTP_CMD_EVENT_ULP,
SCTP_ULPEVENT(ev))) {
sctp_ulpevent_free(ev);
goto nomem;
}
sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_OPERR,
SCTP_CHUNK(chunk));
}
return SCTP_DISPOSITION_CONSUME;
nomem:
return SCTP_DISPOSITION_NOMEM;
}
| 0
|
401,262
|
static void macsec_changelink_common(struct net_device *dev,
struct nlattr *data[])
{
struct macsec_secy *secy;
struct macsec_tx_sc *tx_sc;
secy = &macsec_priv(dev)->secy;
tx_sc = &secy->tx_sc;
if (data[IFLA_MACSEC_ENCODING_SA]) {
struct macsec_tx_sa *tx_sa;
tx_sc->encoding_sa = nla_get_u8(data[IFLA_MACSEC_ENCODING_SA]);
tx_sa = rtnl_dereference(tx_sc->sa[tx_sc->encoding_sa]);
secy->operational = tx_sa && tx_sa->active;
}
if (data[IFLA_MACSEC_WINDOW])
secy->replay_window = nla_get_u32(data[IFLA_MACSEC_WINDOW]);
if (data[IFLA_MACSEC_ENCRYPT])
tx_sc->encrypt = !!nla_get_u8(data[IFLA_MACSEC_ENCRYPT]);
if (data[IFLA_MACSEC_PROTECT])
secy->protect_frames = !!nla_get_u8(data[IFLA_MACSEC_PROTECT]);
if (data[IFLA_MACSEC_INC_SCI])
tx_sc->send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]);
if (data[IFLA_MACSEC_ES])
tx_sc->end_station = !!nla_get_u8(data[IFLA_MACSEC_ES]);
if (data[IFLA_MACSEC_SCB])
tx_sc->scb = !!nla_get_u8(data[IFLA_MACSEC_SCB]);
if (data[IFLA_MACSEC_REPLAY_PROTECT])
secy->replay_protect = !!nla_get_u8(data[IFLA_MACSEC_REPLAY_PROTECT]);
if (data[IFLA_MACSEC_VALIDATION])
secy->validate_frames = nla_get_u8(data[IFLA_MACSEC_VALIDATION]);
}
| 0
|
462,019
|
void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
{
drm_printf(p, "%s firmware: %s\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
drm_printf(p, "\tstatus: %s\n",
intel_uc_fw_status_repr(uc_fw->status));
drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
uc_fw->major_ver_found, uc_fw->minor_ver_found);
drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size);
}
| 0
|
2,827
|
static bool states_equal(struct bpf_verifier_env *env,
struct bpf_verifier_state *old,
struct bpf_verifier_state *cur)
{
int i;
if (old->curframe != cur->curframe)
return false;
/* for states to be equal callsites have to be the same
* and all frame states need to be equivalent
*/
for (i = 0; i <= old->curframe; i++) {
if (old->frame[i]->callsite != cur->frame[i]->callsite)
return false;
if (!func_states_equal(old->frame[i], cur->frame[i]))
return false;
}
return true;
}
| 1
|
353,411
|
dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
{
int i=-1;
hm_fragment *frag = NULL;
pitem *item = NULL;
unsigned char seq64be[8];
unsigned long frag_len = msg_hdr->frag_len;
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
goto err;
/* Try to find item in queue, to prevent duplicate entries */
memset(seq64be,0,sizeof(seq64be));
seq64be[6] = (unsigned char) (msg_hdr->seq>>8);
seq64be[7] = (unsigned char) msg_hdr->seq;
item = pqueue_find(s->d1->buffered_messages, seq64be);
/* Discard the message if sequence number was already there, is
* too far in the future, already in the queue or if we received
* a FINISHED before the SERVER_HELLO, which then must be a stale
* retransmit.
*/
if (msg_hdr->seq <= s->d1->handshake_read_seq ||
msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL ||
(s->d1->handshake_read_seq == 0 && msg_hdr->type == SSL3_MT_FINISHED))
{
unsigned char devnull [256];
while (frag_len)
{
i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
devnull,
frag_len>sizeof(devnull)?sizeof(devnull):frag_len,0);
if (i<=0) goto err;
frag_len -= i;
}
}
if (frag_len)
{
frag = dtls1_hm_fragment_new(frag_len);
if ( frag == NULL)
goto err;
memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
/* read the body of the fragment (header has already been read */
i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
frag->fragment,frag_len,0);
if (i<=0 || (unsigned long)i!=frag_len)
goto err;
memset(seq64be,0,sizeof(seq64be));
seq64be[6] = (unsigned char)(msg_hdr->seq>>8);
seq64be[7] = (unsigned char)(msg_hdr->seq);
item = pitem_new(seq64be, frag);
if ( item == NULL)
goto err;
pqueue_insert(s->d1->buffered_messages, item);
}
return DTLS1_HM_FRAGMENT_RETRY;
err:
if ( frag != NULL) dtls1_hm_fragment_free(frag);
if ( item != NULL) OPENSSL_free(item);
*ok = 0;
return i;
}
| 1
|
276,745
|
count_faces_sfnt( char* fond_data )
{
/* The count is 1 greater than the value in the FOND. */
/* Isn't that cute? :-) */
return EndianS16_BtoN( *( (short*)( fond_data +
sizeof ( FamRec ) ) ) ) + 1;
}
| 0
|
332,020
|
static void gic_complete_irq(gic_state * s, int cpu, int irq)
{
int update = 0;
int cm = 1 << cpu;
DPRINTF("EOI %d\n", irq);
if (s->running_irq[cpu] == 1023)
return; /* No active IRQ. */
if (irq != 1023) {
/* Mark level triggered interrupts as pending if they are still
raised. */
if (!GIC_TEST_TRIGGER(irq) && GIC_TEST_ENABLED(irq, cm)
&& GIC_TEST_LEVEL(irq, cm) && (GIC_TARGET(irq) & cm) != 0) {
DPRINTF("Set %d pending mask %x\n", irq, cm);
GIC_SET_PENDING(irq, cm);
update = 1;
}
}
if (irq != s->running_irq[cpu]) {
/* Complete an IRQ that is not currently running. */
int tmp = s->running_irq[cpu];
while (s->last_active[tmp][cpu] != 1023) {
if (s->last_active[tmp][cpu] == irq) {
s->last_active[tmp][cpu] = s->last_active[irq][cpu];
break;
}
tmp = s->last_active[tmp][cpu];
}
if (update) {
gic_update(s);
}
} else {
/* Complete the current running IRQ. */
gic_set_running_irq(s, cpu, s->last_active[s->running_irq[cpu]][cpu]);
}
}
| 1
|
418,939
|
ZEND_METHOD(Generator, next)
{
zend_generator *generator;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
generator = (zend_generator *) Z_OBJ_P(getThis());
zend_generator_ensure_initialized(generator);
zend_generator_resume(generator);
}
| 0
|
503,238
|
TEST_F(OptimizePipeline, InternalizeProjectAndPushdownAddFields) {
auto unpackSpecObj = fromjson(
"{$_internalUnpackBucket: { exclude: [], timeField: 'time', metaField: 'myMeta', "
"bucketMaxSpanSeconds: 3600}}");
auto projectSpecObj = fromjson("{$project: {x: true, y: true, myMeta: true}}");
auto addFieldsSpec = fromjson("{$addFields: {newMeta: '$myMeta.a'}}");
auto pipeline =
Pipeline::parse(makeVector(unpackSpecObj, projectSpecObj, addFieldsSpec), getExpCtx());
pipeline->optimizePipeline();
// We should internalize the $project and push down the $addFields.
auto serialized = pipeline->serializeToBson();
ASSERT_EQ(2u, serialized.size());
ASSERT_BSONOBJ_EQ(fromjson("{$addFields: {newMeta: '$meta.a'}}"), serialized[0]);
ASSERT_BSONOBJ_EQ(fromjson("{$_internalUnpackBucket: { include: ['_id', 'newMeta', 'x', 'y', "
"'myMeta'], timeField: 'time', metaField: 'myMeta', "
"bucketMaxSpanSeconds: 3600, computedMetaProjFields: ['newMeta']}}"),
serialized[1]);
}
| 0
|
370,746
|
static void tripmate_event_hook(struct gps_device_t *session, event_t event)
{
if (session->context->readonly)
return;
/* TripMate requires this response to the ASTRAL it sends at boot time */
if (event == event_identified)
(void)nmea_send(session, "$IIGPQ,ASTRAL");
/* stop it sending PRWIZCH */
if (event == event_identified || event == event_reactivate)
(void)nmea_send(session, "$PRWIILOG,ZCH,V,,");
}
| 0
|
16,576
|
static ActivationAction get_executable_text_file_action ( GtkWindow * parent_window , NautilusFile * file ) {
GtkDialog * dialog ;
char * file_name ;
char * prompt ;
char * detail ;
int preferences_value ;
int response ;
g_assert ( nautilus_file_contains_text ( file ) ) ;
preferences_value = g_settings_get_enum ( nautilus_preferences , NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION ) ;
switch ( preferences_value ) {
case NAUTILUS_EXECUTABLE_TEXT_LAUNCH : {
return ACTIVATION_ACTION_LAUNCH ;
}
case NAUTILUS_EXECUTABLE_TEXT_DISPLAY : {
return ACTIVATION_ACTION_OPEN_IN_APPLICATION ;
}
case NAUTILUS_EXECUTABLE_TEXT_ASK : {
}
break ;
default : g_warning ( "Unknown value %d for NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION" , preferences_value ) ;
}
file_name = nautilus_file_get_display_name ( file ) ;
prompt = g_strdup_printf ( _ ( "Do you want to run “%s”, or display its contents?" ) , file_name ) ;
detail = g_strdup_printf ( _ ( "“%s” is an executable text file." ) , file_name ) ;
g_free ( file_name ) ;
dialog = eel_create_question_dialog ( prompt , detail , _ ( "Run in _Terminal" ) , RESPONSE_RUN_IN_TERMINAL , _ ( "_Display" ) , RESPONSE_DISPLAY , parent_window ) ;
gtk_dialog_add_button ( dialog , _ ( "_Cancel" ) , GTK_RESPONSE_CANCEL ) ;
gtk_dialog_add_button ( dialog , _ ( "_Run" ) , RESPONSE_RUN ) ;
gtk_dialog_set_default_response ( dialog , GTK_RESPONSE_CANCEL ) ;
gtk_widget_show ( GTK_WIDGET ( dialog ) ) ;
g_free ( prompt ) ;
g_free ( detail ) ;
response = gtk_dialog_run ( dialog ) ;
gtk_widget_destroy ( GTK_WIDGET ( dialog ) ) ;
switch ( response ) {
case RESPONSE_RUN : {
return ACTIVATION_ACTION_LAUNCH ;
}
case RESPONSE_RUN_IN_TERMINAL : {
return ACTIVATION_ACTION_LAUNCH_IN_TERMINAL ;
}
case RESPONSE_DISPLAY : {
return ACTIVATION_ACTION_OPEN_IN_APPLICATION ;
}
default : return ACTIVATION_ACTION_DO_NOTHING ;
}
}
| 0
|
440,044
|
MagickExport void XDestroyResourceInfo(XResourceInfo *resource_info)
{
if (resource_info->image_geometry != (char *) NULL)
resource_info->image_geometry=(char *)
RelinquishMagickMemory(resource_info->image_geometry);
if (resource_info->quantize_info != (QuantizeInfo *) NULL)
resource_info->quantize_info=DestroyQuantizeInfo(
resource_info->quantize_info);
if (resource_info->client_name != (char *) NULL)
resource_info->client_name=(char *)
RelinquishMagickMemory(resource_info->client_name);
if (resource_info->name != (char *) NULL)
resource_info->name=DestroyString(resource_info->name);
(void) memset(resource_info,0,sizeof(*resource_info));
}
| 0
|
130,117
|
void accept(std::shared_ptr<ServerTransportParametersExtension>) override {}
| 0
|
414,231
|
GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **errp)
{
error_setg(errp, QERR_UNSUPPORTED);
return 0;
}
| 0
|
439,063
|
static void SFDDumpAnchorPoints(FILE *sfd,AnchorPoint *ap) {
if (ap==NULL) {
return;
}
for ( ; ap!=NULL; ap=ap->next )
{
fprintf( sfd, "AnchorPoint: " );
SFDDumpUTF7Str(sfd,ap->anchor->name);
putc(' ',sfd);
fprintf( sfd, "%g %g %s %d",
(double) ap->me.x, (double) ap->me.y,
ap->type==at_centry ? "entry" :
ap->type==at_cexit ? "exit" :
ap->type==at_mark ? "mark" :
ap->type==at_basechar ? "basechar" :
ap->type==at_baselig ? "baselig" : "basemark",
ap->lig_index );
if ( ap->xadjust.corrections!=NULL || ap->yadjust.corrections!=NULL ) {
putc(' ',sfd);
SFDDumpDeviceTable(sfd,&ap->xadjust);
putc(' ',sfd);
SFDDumpDeviceTable(sfd,&ap->yadjust);
} else
if ( ap->has_ttf_pt )
fprintf( sfd, " %d", ap->ttf_pt_index );
putc('\n',sfd);
}
}
| 0
|
25,379
|
static int ilbc_encode_frame ( AVCodecContext * avctx , AVPacket * avpkt , const AVFrame * frame , int * got_packet_ptr ) {
ILBCEncContext * s = avctx -> priv_data ;
int ret ;
if ( ( ret = ff_alloc_packet ( avpkt , 50 ) ) ) {
av_log ( avctx , AV_LOG_ERROR , "Error getting output packet\n" ) ;
return ret ;
}
WebRtcIlbcfix_EncodeImpl ( ( WebRtc_UWord16 * ) avpkt -> data , ( const WebRtc_Word16 * ) frame -> data [ 0 ] , & s -> encoder ) ;
avpkt -> size = s -> encoder . no_of_bytes ;
* got_packet_ptr = 1 ;
return 0 ;
}
| 0
|
465,723
|
static void fuse_prepare_release(struct fuse_inode *fi, struct fuse_file *ff,
int flags, int opcode)
{
struct fuse_conn *fc = ff->fm->fc;
struct fuse_release_args *ra = ff->release_args;
/* Inode is NULL on error path of fuse_create_open() */
if (likely(fi)) {
spin_lock(&fi->lock);
list_del(&ff->write_entry);
spin_unlock(&fi->lock);
}
spin_lock(&fc->lock);
if (!RB_EMPTY_NODE(&ff->polled_node))
rb_erase(&ff->polled_node, &fc->polled_files);
spin_unlock(&fc->lock);
wake_up_interruptible_all(&ff->poll_wait);
ra->inarg.fh = ff->fh;
ra->inarg.flags = flags;
ra->args.in_numargs = 1;
ra->args.in_args[0].size = sizeof(struct fuse_release_in);
ra->args.in_args[0].value = &ra->inarg;
ra->args.opcode = opcode;
ra->args.nodeid = ff->nodeid;
ra->args.force = true;
ra->args.nocreds = true;
}
| 0
|
55,881
|
bool __fastcall TCommandSet::GetOneLineCommand(TFSCommand /*Cmd*/)
{
//CHECK_CMD;
// #56: we send "echo last line" from all commands on same line
// just as it was in 1.0
return True; //CommandSet[Cmd].OneLineCommand;
}
| 0
|
6,377
|
void Compute(OpKernelContext* context) override {
const Tensor& images = context->input(0);
const Tensor& boxes = context->input(1);
const int64 depth = images.dim_size(3);
OP_REQUIRES(context, images.dims() == 4,
errors::InvalidArgument("The rank of the images should be 4"));
OP_REQUIRES(
context, boxes.dims() == 3,
errors::InvalidArgument("The rank of the boxes tensor should be 3"));
OP_REQUIRES(context, images.dim_size(0) == boxes.dim_size(0),
errors::InvalidArgument("The batch sizes should be the same"));
OP_REQUIRES(
context, depth == 4 || depth == 1 || depth == 3,
errors::InvalidArgument("Channel depth should be either 1 (GRY), "
"3 (RGB), or 4 (RGBA)"));
const int64 batch_size = images.dim_size(0);
const int64 height = images.dim_size(1);
const int64 width = images.dim_size(2);
std::vector<std::vector<float>> color_table;
if (context->num_inputs() == 3) {
const Tensor& colors_tensor = context->input(2);
OP_REQUIRES(context, colors_tensor.shape().dims() == 2,
errors::InvalidArgument("colors must be a 2-D matrix",
colors_tensor.shape().DebugString()));
OP_REQUIRES(context, colors_tensor.shape().dim_size(1) >= depth,
errors::InvalidArgument("colors must have equal or more ",
"channels than the image provided: ",
colors_tensor.shape().DebugString()));
if (colors_tensor.NumElements() != 0) {
color_table.clear();
auto colors = colors_tensor.matrix<float>();
for (int64 i = 0; i < colors.dimension(0); i++) {
std::vector<float> color_value(4);
for (int64 j = 0; j < 4; j++) {
color_value[j] = colors(i, j);
}
color_table.emplace_back(color_value);
}
}
}
if (color_table.empty()) {
color_table = DefaultColorTable(depth);
}
Tensor* output;
OP_REQUIRES_OK(
context,
context->allocate_output(
0, TensorShape({batch_size, height, width, depth}), &output));
output->tensor<T, 4>() = images.tensor<T, 4>();
auto canvas = output->tensor<T, 4>();
for (int64 b = 0; b < batch_size; ++b) {
const int64 num_boxes = boxes.dim_size(1);
const auto tboxes = boxes.tensor<T, 3>();
for (int64 bb = 0; bb < num_boxes; ++bb) {
int64 color_index = bb % color_table.size();
const int64 min_box_row =
static_cast<float>(tboxes(b, bb, 0)) * (height - 1);
const int64 min_box_row_clamp = std::max<int64>(min_box_row, int64{0});
const int64 max_box_row =
static_cast<float>(tboxes(b, bb, 2)) * (height - 1);
const int64 max_box_row_clamp =
std::min<int64>(max_box_row, height - 1);
const int64 min_box_col =
static_cast<float>(tboxes(b, bb, 1)) * (width - 1);
const int64 min_box_col_clamp = std::max<int64>(min_box_col, int64{0});
const int64 max_box_col =
static_cast<float>(tboxes(b, bb, 3)) * (width - 1);
const int64 max_box_col_clamp = std::min<int64>(max_box_col, width - 1);
if (min_box_row > max_box_row || min_box_col > max_box_col) {
LOG(WARNING) << "Bounding box (" << min_box_row << "," << min_box_col
<< "," << max_box_row << "," << max_box_col
<< ") is inverted and will not be drawn.";
continue;
}
if (min_box_row >= height || max_box_row < 0 || min_box_col >= width ||
max_box_col < 0) {
LOG(WARNING) << "Bounding box (" << min_box_row << "," << min_box_col
<< "," << max_box_row << "," << max_box_col
<< ") is completely outside the image"
<< " and will not be drawn.";
continue;
}
// At this point, {min,max}_box_{row,col}_clamp are inside the
// image.
OP_REQUIRES(
context, min_box_row_clamp >= 0,
errors::InvalidArgument("Min box row clamp is less than 0."));
OP_REQUIRES(
context, max_box_row_clamp >= 0,
errors::InvalidArgument("Max box row clamp is less than 0."));
OP_REQUIRES(context, min_box_row_clamp <= height,
errors::InvalidArgument(
"Min box row clamp is greater than height."));
OP_REQUIRES(context, max_box_row_clamp <= height,
errors::InvalidArgument(
"Max box row clamp is greater than height."));
OP_REQUIRES(
context, min_box_col_clamp >= 0,
errors::InvalidArgument("Min box col clamp is less than 0."));
OP_REQUIRES(
context, max_box_col_clamp >= 0,
errors::InvalidArgument("Max box col clamp is less than 0."));
OP_REQUIRES(context, min_box_col_clamp <= width,
errors::InvalidArgument(
"Min box col clamp is greater than width."));
OP_REQUIRES(context, max_box_col_clamp <= width,
errors::InvalidArgument(
"Max box col clamp is greater than width."));
// At this point, the min_box_row and min_box_col are either
// in the image or above/left of it, and max_box_row and
// max_box_col are either in the image or below/right or it.
OP_REQUIRES(
context, min_box_row <= height,
errors::InvalidArgument("Min box row is greater than height."));
OP_REQUIRES(context, max_box_row >= 0,
errors::InvalidArgument("Max box row is less than 0."));
OP_REQUIRES(
context, min_box_col <= width,
errors::InvalidArgument("Min box col is greater than width."));
OP_REQUIRES(context, max_box_col >= 0,
errors::InvalidArgument("Max box col is less than 0."));
// Draw top line.
if (min_box_row >= 0) {
for (int64 j = min_box_col_clamp; j <= max_box_col_clamp; ++j)
for (int64 c = 0; c < depth; c++) {
canvas(b, min_box_row, j, c) =
static_cast<T>(color_table[color_index][c]);
}
}
// Draw bottom line.
if (max_box_row < height) {
for (int64 j = min_box_col_clamp; j <= max_box_col_clamp; ++j)
for (int64 c = 0; c < depth; c++) {
canvas(b, max_box_row, j, c) =
static_cast<T>(color_table[color_index][c]);
}
}
// Draw left line.
if (min_box_col >= 0) {
for (int64 i = min_box_row_clamp; i <= max_box_row_clamp; ++i)
for (int64 c = 0; c < depth; c++) {
canvas(b, i, min_box_col, c) =
static_cast<T>(color_table[color_index][c]);
}
}
// Draw right line.
if (max_box_col < width) {
for (int64 i = min_box_row_clamp; i <= max_box_row_clamp; ++i)
for (int64 c = 0; c < depth; c++) {
canvas(b, i, max_box_col, c) =
static_cast<T>(color_table[color_index][c]);
}
}
}
}
}
| 1
|
338,012
|
static void gen_dccci(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
/* interpreted as no-op */
#endif
}
| 1
|
41,674
|
NO_INLINE JsVar *__jspePostfixExpression(JsVar *a) {
while (lex->tk==LEX_PLUSPLUS || lex->tk==LEX_MINUSMINUS) {
int op = lex->tk;
JSP_ASSERT_MATCH(op);
if (JSP_SHOULD_EXECUTE) {
JsVar *one = jsvNewFromInteger(1);
JsVar *oldValue = jsvAsNumberAndUnLock(jsvSkipName(a)); // keep the old value (but convert to number)
JsVar *res = jsvMathsOpSkipNames(oldValue, one, op==LEX_PLUSPLUS ? '+' : '-');
jsvUnLock(one);
// in-place add/subtract
jsvReplaceWith(a, res);
jsvUnLock(res);
// but then use the old value
jsvUnLock(a);
a = oldValue;
}
}
return a;
}
| 0
|
492,912
|
static void ssl_write_cid_ext( mbedtls_ssl_context *ssl,
unsigned char *buf,
size_t *olen )
{
unsigned char *p = buf;
size_t ext_len;
const unsigned char *end = ssl->out_msg + MBEDTLS_SSL_OUT_CONTENT_LEN;
*olen = 0;
/* Skip writing the extension if we don't want to use it or if
* the client hasn't offered it. */
if( ssl->handshake->cid_in_use == MBEDTLS_SSL_CID_DISABLED )
return;
/* ssl->own_cid_len is at most MBEDTLS_SSL_CID_IN_LEN_MAX
* which is at most 255, so the increment cannot overflow. */
if( end < p || (size_t)( end - p ) < (unsigned)( ssl->own_cid_len + 5 ) )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "buffer too small" ) );
return;
}
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, adding CID extension" ) );
/*
* Quoting draft-ietf-tls-dtls-connection-id-05
* https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05
*
* struct {
* opaque cid<0..2^8-1>;
* } ConnectionId;
*/
MBEDTLS_PUT_UINT16_BE( MBEDTLS_TLS_EXT_CID, p, 0 );
p += 2;
ext_len = (size_t) ssl->own_cid_len + 1;
MBEDTLS_PUT_UINT16_BE( ext_len, p, 0 );
p += 2;
*p++ = (uint8_t) ssl->own_cid_len;
memcpy( p, ssl->own_cid, ssl->own_cid_len );
*olen = ssl->own_cid_len + 5;
}
| 0
|
499,177
|
static void gf_isom_write_tx3g(GF_Tx3gSampleEntryBox *_a, GF_BitStream *bs, u32 sidx, u32 sidx_offset)
{
u32 size, j, fount_count;
const char *qt_fontname = NULL;
void gpp_write_rgba(GF_BitStream *bs, u32 col);
void gpp_write_box(GF_BitStream *bs, GF_BoxRecord *rec);
void gpp_write_style(GF_BitStream *bs, GF_StyleRecord *rec);
GF_TextSampleEntryBox *qt = (_a->type==GF_ISOM_BOX_TYPE_TEXT) ? (GF_TextSampleEntryBox *)_a : NULL;
GF_Tx3gSampleEntryBox *ttxt = (_a->type!=GF_ISOM_BOX_TYPE_TEXT) ? (GF_Tx3gSampleEntryBox *)_a : NULL;
if (sidx_offset) gf_bs_write_u8(bs, sidx + sidx_offset);
/*SINCE WINCE HAS A READONLY VERSION OF MP4 WE MUST DO IT BY HAND*/
size = 8 + 18 + 8 + 12;
size += 8 + 2;
fount_count = 0;
if (qt && qt->textName) {
qt_fontname = qt->textName;
fount_count = 1;
} else if (ttxt && ttxt->font_table) {
fount_count = ttxt->font_table->entry_count;
for (j=0; j<fount_count; j++) {
size += 3;
if (ttxt->font_table->fonts[j].fontName)
size += (u32) strlen(ttxt->font_table->fonts[j].fontName);
}
}
/*write TextSampleEntry box*/
gf_bs_write_u32(bs, size);
gf_bs_write_u32(bs, GF_ISOM_BOX_TYPE_TX3G);
gf_bs_write_data(bs, _a->reserved, 6);
gf_bs_write_u16(bs, _a->dataReferenceIndex);
gf_bs_write_u32(bs, _a->displayFlags);
if (qt) {
GF_StyleRecord sr;
memset(&sr, 0, sizeof(GF_StyleRecord));
gf_bs_write_u8(bs, qt->textJustification);
gf_bs_write_u8(bs, (u8) -1);
gpp_write_rgba(bs, rgb_48_to_32(qt->background_color) );
gpp_write_box(bs, &qt->default_box);
sr.text_color = rgb_48_to_32(qt->foreground_color);
sr.style_flags = 0; //todo expose qt->fontFace;
gpp_write_style(bs, &sr);
} else {
gf_bs_write_u8(bs, ttxt->horizontal_justification);
gf_bs_write_u8(bs, ttxt->vertical_justification);
gpp_write_rgba(bs, ttxt->back_color);
gpp_write_box(bs, &ttxt->default_box);
gpp_write_style(bs, &ttxt->default_style);
}
/*write font table box*/
size -= (8 + 18 + 8 + 12);
gf_bs_write_u32(bs, size);
gf_bs_write_u32(bs, GF_ISOM_BOX_TYPE_FTAB);
gf_bs_write_u16(bs, fount_count);
for (j=0; j<fount_count; j++) {
if (qt) {
gf_bs_write_u16(bs, 0);
if (qt_fontname) {
u32 len = (u32) strlen(qt_fontname);
gf_bs_write_u8(bs, len);
gf_bs_write_data(bs, qt_fontname, len);
} else {
gf_bs_write_u8(bs, 0);
}
} else {
gf_bs_write_u16(bs, ttxt->font_table->fonts[j].fontID);
if (ttxt->font_table->fonts[j].fontName) {
u32 len = (u32) strlen(ttxt->font_table->fonts[j].fontName);
gf_bs_write_u8(bs, len);
gf_bs_write_data(bs, ttxt->font_table->fonts[j].fontName, len);
} else {
gf_bs_write_u8(bs, 0);
}
}
}
}
| 0
|
259,766
|
md_process_table_cell(MD_CTX* ctx, MD_BLOCKTYPE cell_type, MD_ALIGN align, OFF beg, OFF end)
{
MD_LINE line;
MD_BLOCK_TD_DETAIL det;
int ret = 0;
while(beg < end && ISWHITESPACE(beg))
beg++;
while(end > beg && ISWHITESPACE(end-1))
end--;
det.align = align;
line.beg = beg;
line.end = end;
MD_ENTER_BLOCK(cell_type, &det);
MD_CHECK(md_process_normal_block_contents(ctx, &line, 1));
MD_LEAVE_BLOCK(cell_type, &det);
abort:
return ret;
}
| 0
|
420,641
|
modify_param_name(param_token *name)
{
const char *delim1 = memchr (name->b, '*', name->e - name->b);
const char *delim2 = memrchr (name->b, '*', name->e - name->b);
int result;
if(delim1 == NULL)
{
result = NOT_RFC2231;
}
else if(delim1 == delim2)
{
if ((name->e - 1) == delim1)
{
result = RFC2231_ENCODING;
}
else
{
result = RFC2231_NOENCODING;
}
name->e = delim1;
}
else
{
name->e = delim1;
result = RFC2231_ENCODING;
}
return result;
}
| 0
|
345,512
|
static void fix_hostname(struct SessionHandle *data,
struct connectdata *conn, struct hostname *host)
{
size_t len;
#ifndef USE_LIBIDN
(void)data;
(void)conn;
#elif defined(CURL_DISABLE_VERBOSE_STRINGS)
(void)conn;
#endif
/* set the name we use to display the host name */
host->dispname = host->name;
len = strlen(host->name);
if(host->name[len-1] == '.')
/* strip off a single trailing dot if present, primarily for SNI but
there's no use for it */
host->name[len-1]=0;
if(!is_ASCII_name(host->name)) {
#ifdef USE_LIBIDN
/*************************************************************
* Check name for non-ASCII and convert hostname to ACE form.
*************************************************************/
if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
char *ace_hostname = NULL;
int rc = idna_to_ascii_lz(host->name, &ace_hostname, 0);
infof (data, "Input domain encoded as `%s'\n",
stringprep_locale_charset ());
if(rc != IDNA_SUCCESS)
infof(data, "Failed to convert %s to ACE; %s\n",
host->name, Curl_idn_strerror(conn, rc));
else {
/* tld_check_name() displays a warning if the host name contains
"illegal" characters for this TLD */
(void)tld_check_name(data, ace_hostname);
host->encalloc = ace_hostname;
/* change the name pointer to point to the encoded hostname */
host->name = host->encalloc;
}
}
#elif defined(USE_WIN32_IDN)
/*************************************************************
* Check name for non-ASCII and convert hostname to ACE form.
*************************************************************/
char *ace_hostname = NULL;
int rc = curl_win32_idn_to_ascii(host->name, &ace_hostname);
if(rc == 0)
infof(data, "Failed to convert %s to ACE;\n",
host->name);
else {
host->encalloc = ace_hostname;
/* change the name pointer to point to the encoded hostname */
host->name = host->encalloc;
}
#else
infof(data, "IDN support not present, can't parse Unicode domains\n");
#endif
}
}
| 1
|
69,361
|
static int do_stop_slave_sql(MYSQL *mysql_con)
{
MYSQL_RES *slave;
/* We need to check if the slave sql is running in the first place */
if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS"))
return(1);
else
{
MYSQL_ROW row= mysql_fetch_row(slave);
if (row && row[11])
{
/* if SLAVE SQL is not running, we don't stop it */
if (!strcmp(row[11],"No"))
{
mysql_free_result(slave);
/* Silently assume that they don't have the slave running */
return(0);
}
}
}
mysql_free_result(slave);
/* now, stop slave if running */
if (mysql_query_with_error_report(mysql_con, 0, "STOP SLAVE SQL_THREAD"))
return(1);
return(0);
}
| 0
|
488,308
|
static s64 ntfs_attr_pread_i(ntfs_attr *na, const s64 pos, s64 count, void *b)
{
s64 br, to_read, ofs, total, total2, max_read, max_init;
ntfs_volume *vol;
runlist_element *rl;
u16 efs_padding_length;
/* Sanity checking arguments is done in ntfs_attr_pread(). */
if ((na->data_flags & ATTR_COMPRESSION_MASK) && NAttrNonResident(na)) {
if ((na->data_flags & ATTR_COMPRESSION_MASK)
== ATTR_IS_COMPRESSED)
return ntfs_compressed_attr_pread(na, pos, count, b);
else {
/* compression mode not supported */
errno = EOPNOTSUPP;
return -1;
}
}
/*
* Encrypted non-resident attributes are not supported. We return
* access denied, which is what Windows NT4 does, too.
* However, allow if mounted with efs_raw option
*/
vol = na->ni->vol;
if (!vol->efs_raw && NAttrEncrypted(na) && NAttrNonResident(na)) {
errno = EACCES;
return -1;
}
if (!count)
return 0;
/*
* Truncate reads beyond end of attribute,
* but round to next 512 byte boundary for encrypted
* attributes with efs_raw mount option
*/
max_read = na->data_size;
max_init = na->initialized_size;
if (na->ni->vol->efs_raw
&& (na->data_flags & ATTR_IS_ENCRYPTED)
&& NAttrNonResident(na)) {
if (na->data_size != na->initialized_size) {
ntfs_log_error("uninitialized encrypted file not supported\n");
errno = EINVAL;
return -1;
}
max_init = max_read = ((na->data_size + 511) & ~511) + 2;
}
if (pos + count > max_read) {
if (pos >= max_read)
return 0;
count = max_read - pos;
}
/* If it is a resident attribute, get the value from the mft record. */
if (!NAttrNonResident(na)) {
ntfs_attr_search_ctx *ctx;
char *val;
ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
if (!ctx)
return -1;
if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0,
0, NULL, 0, ctx)) {
res_err_out:
ntfs_attr_put_search_ctx(ctx);
return -1;
}
val = (char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset);
if (val < (char*)ctx->attr || val +
le32_to_cpu(ctx->attr->value_length) >
(char*)ctx->mrec + vol->mft_record_size) {
errno = EIO;
ntfs_log_perror("%s: Sanity check failed", __FUNCTION__);
goto res_err_out;
}
memcpy(b, val + pos, count);
ntfs_attr_put_search_ctx(ctx);
return count;
}
total = total2 = 0;
/* Zero out reads beyond initialized size. */
if (pos + count > max_init) {
if (pos >= max_init) {
memset(b, 0, count);
return count;
}
total2 = pos + count - max_init;
count -= total2;
memset((u8*)b + count, 0, total2);
}
/*
* for encrypted non-resident attributes with efs_raw set
* the last two bytes aren't read from disk but contain
* the number of padding bytes so original size can be
* restored
*/
if (na->ni->vol->efs_raw &&
(na->data_flags & ATTR_IS_ENCRYPTED) &&
((pos + count) > max_init-2)) {
efs_padding_length = 511 - ((na->data_size - 1) & 511);
if (pos+count == max_init) {
if (count == 1) {
*((u8*)b+count-1) = (u8)(efs_padding_length >> 8);
count--;
total2++;
} else {
*(le16*)((u8*)b+count-2) = cpu_to_le16(efs_padding_length);
count -= 2;
total2 +=2;
}
} else {
*((u8*)b+count-1) = (u8)(efs_padding_length & 0xff);
count--;
total2++;
}
}
/* Find the runlist element containing the vcn. */
rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits);
if (!rl) {
/*
* If the vcn is not present it is an out of bounds read.
* However, we already truncated the read to the data_size,
* so getting this here is an error.
*/
if (errno == ENOENT) {
errno = EIO;
ntfs_log_perror("%s: Failed to find VCN #1", __FUNCTION__);
}
return -1;
}
/*
* Gather the requested data into the linear destination buffer. Note,
* a partial final vcn is taken care of by the @count capping of read
* length.
*/
ofs = pos - (rl->vcn << vol->cluster_size_bits);
for (; count; rl++, ofs = 0) {
if (rl->lcn == LCN_RL_NOT_MAPPED) {
rl = ntfs_attr_find_vcn(na, rl->vcn);
if (!rl) {
if (errno == ENOENT) {
errno = EIO;
ntfs_log_perror("%s: Failed to find VCN #2",
__FUNCTION__);
}
goto rl_err_out;
}
/* Needed for case when runs merged. */
ofs = pos + total - (rl->vcn << vol->cluster_size_bits);
}
if (!rl->length) {
errno = EIO;
ntfs_log_perror("%s: Zero run length", __FUNCTION__);
goto rl_err_out;
}
if (rl->lcn < (LCN)0) {
if (rl->lcn != (LCN)LCN_HOLE) {
ntfs_log_perror("%s: Bad run (%lld)",
__FUNCTION__,
(long long)rl->lcn);
goto rl_err_out;
}
/* It is a hole, just zero the matching @b range. */
to_read = min(count, (rl->length <<
vol->cluster_size_bits) - ofs);
memset(b, 0, to_read);
/* Update progress counters. */
total += to_read;
count -= to_read;
b = (u8*)b + to_read;
continue;
}
/* It is a real lcn, read it into @dst. */
to_read = min(count, (rl->length << vol->cluster_size_bits) -
ofs);
retry:
ntfs_log_trace("Reading %lld bytes from vcn %lld, lcn %lld, ofs"
" %lld.\n", (long long)to_read, (long long)rl->vcn,
(long long )rl->lcn, (long long)ofs);
br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) +
ofs, to_read, b);
/* If everything ok, update progress counters and continue. */
if (br > 0) {
total += br;
count -= br;
b = (u8*)b + br;
}
if (br == to_read)
continue;
/* If the syscall was interrupted, try again. */
if (br == (s64)-1 && errno == EINTR)
goto retry;
if (total)
return total;
if (!br)
errno = EIO;
ntfs_log_perror("%s: ntfs_pread failed", __FUNCTION__);
return -1;
}
/* Finally, return the number of bytes read. */
return total + total2;
rl_err_out:
if (total)
return total;
errno = EIO;
return -1;
}
| 0
|
354,082
|
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
fprintf(stderr, "This program requires terminfo\n");
exit(EXIT_FAILURE);
}
| 1
|
76,125
|
static ssize_t pstr_store(struct device *kdev,
struct device_attribute *kattr, const char *buf,
size_t count)
{
struct hid_device *hdev = to_hid_device(kdev);
struct cp2112_pstring_attribute *attr =
container_of(kattr, struct cp2112_pstring_attribute, attr);
struct cp2112_string_report report;
int ret;
memset(&report, 0, sizeof(report));
ret = utf8s_to_utf16s(buf, count, UTF16_LITTLE_ENDIAN,
report.string, ARRAY_SIZE(report.string));
report.report = attr->report;
report.length = ret * sizeof(report.string[0]) + 2;
report.type = USB_DT_STRING;
ret = cp2112_hid_output(hdev, &report.report, report.length + 1,
HID_FEATURE_REPORT);
if (ret != report.length + 1) {
hid_err(hdev, "error writing %s string: %d\n", kattr->attr.name,
ret);
if (ret < 0)
return ret;
return -EIO;
}
chmod_sysfs_attrs(hdev);
return count;
}
| 0
|
293,488
|
hotremove_migrate_alloc(struct page *page, unsigned long private, int **x)
{
/* This should be improooooved!! */
return alloc_page(GFP_HIGHUSER_MOVABLE);
}
| 0
|
288,372
|
v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getExtensionCallback()");
WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
if (args.Length() < 1)
return V8Proxy::throwNotEnoughArgumentsError();
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
WebGLExtension* extension = imp->getExtension(name);
return toV8Object(extension, args.Holder(), args.GetIsolate());
}
| 1
|
243,130
|
static int __mkroute_input(struct sk_buff *skb,
const struct fib_result *res,
struct in_device *in_dev,
__be32 daddr, __be32 saddr, u32 tos)
{
struct fib_nh_exception *fnhe;
struct rtable *rth;
int err;
struct in_device *out_dev;
unsigned int flags = 0;
bool do_cache;
u32 itag = 0;
/* get a working reference to the output device */
out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res));
if (out_dev == NULL) {
net_crit_ratelimited("Bug in ip_route_input_slow(). Please report.\n");
return -EINVAL;
}
err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res),
in_dev->dev, in_dev, &itag);
if (err < 0) {
ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr,
saddr);
goto cleanup;
}
do_cache = res->fi && !itag;
if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
skb->protocol == htons(ETH_P_IP) &&
(IN_DEV_SHARED_MEDIA(out_dev) ||
inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
IPCB(skb)->flags |= IPSKB_DOREDIRECT;
if (skb->protocol != htons(ETH_P_IP)) {
/* Not IP (i.e. ARP). Do not create route, if it is
* invalid for proxy arp. DNAT routes are always valid.
*
* Proxy arp feature have been extended to allow, ARP
* replies back to the same interface, to support
* Private VLAN switch technologies. See arp.c.
*/
if (out_dev == in_dev &&
IN_DEV_PROXY_ARP_PVLAN(in_dev) == 0) {
err = -EINVAL;
goto cleanup;
}
}
fnhe = find_exception(&FIB_RES_NH(*res), daddr);
if (do_cache) {
if (fnhe != NULL)
rth = rcu_dereference(fnhe->fnhe_rth_input);
else
rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
if (rt_cache_valid(rth)) {
skb_dst_set_noref(skb, &rth->dst);
goto out;
}
}
rth = rt_dst_alloc(out_dev->dev,
IN_DEV_CONF_GET(in_dev, NOPOLICY),
IN_DEV_CONF_GET(out_dev, NOXFRM), do_cache);
if (!rth) {
err = -ENOBUFS;
goto cleanup;
}
rth->rt_genid = rt_genid_ipv4(dev_net(rth->dst.dev));
rth->rt_flags = flags;
rth->rt_type = res->type;
rth->rt_is_input = 1;
rth->rt_iif = 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(in_slow_tot);
rth->dst.input = ip_forward;
rth->dst.output = ip_output;
rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag);
skb_dst_set(skb, &rth->dst);
out:
err = 0;
cleanup:
return err;
}
| 0
|
179,673
|
void Browser::Zoom(PageZoom::Function zoom_function) {
static const UserMetricsAction kActions[] = {
UserMetricsAction("ZoomMinus"),
UserMetricsAction("ZoomNormal"),
UserMetricsAction("ZoomPlus")
};
UserMetrics::RecordAction(kActions[zoom_function - PageZoom::ZOOM_OUT],
profile_);
TabContentsWrapper* tab_contents = GetSelectedTabContentsWrapper();
tab_contents->render_view_host()->Zoom(zoom_function);
}
| 0
|
142,571
|
static int decode_level2_header(LHAFileHeader **header, LHAInputStream *stream)
{
unsigned int header_len;
header_len = lha_decode_uint16(&RAW_DATA(header, 0));
if (header_len < LEVEL_2_HEADER_LEN) {
return 0;
}
// Read the full header.
if (!extend_raw_data(header, stream,
header_len - RAW_DATA_LEN(header))) {
return 0;
}
// Compression method:
memcpy((*header)->compress_method, &RAW_DATA(header, 2), 5);
(*header)->compress_method[5] = '\0';
// File lengths:
(*header)->compressed_length = lha_decode_uint32(&RAW_DATA(header, 7));
(*header)->length = lha_decode_uint32(&RAW_DATA(header, 11));
// Timestamp. Unlike level 0/1, this is a Unix-style timestamp.
(*header)->timestamp = lha_decode_uint32(&RAW_DATA(header, 15));
// CRC.
(*header)->crc = lha_decode_uint16(&RAW_DATA(header, 21));
// OS type:
(*header)->os_type = RAW_DATA(header, 23);
// LHA for OS-9/68k generates broken level 2 archives: the header
// length field is the length of the remainder of the header, not
// the complete header length. As a result it's two bytes too
// short. We can use the OS type field to detect these archives
// and compensate.
if ((*header)->os_type == LHA_OS_TYPE_OS9_68K) {
if (!extend_raw_data(header, stream, 2)) {
return 0;
}
}
if (!decode_extended_headers(header, 24)) {
return 0;
}
return 1;
}
| 0
|
32,862
|
OPJ_UINT32 opj_tcd_get_decoded_tile_size ( opj_tcd_t *p_tcd )
{
OPJ_UINT32 i;
OPJ_UINT32 l_data_size = 0;
opj_image_comp_t * l_img_comp = 00;
opj_tcd_tilecomp_t * l_tile_comp = 00;
opj_tcd_resolution_t * l_res = 00;
OPJ_UINT32 l_size_comp, l_remaining;
l_tile_comp = p_tcd->tcd_image->tiles->comps;
l_img_comp = p_tcd->image->comps;
for (i=0;i<p_tcd->image->numcomps;++i) {
l_size_comp = l_img_comp->prec >> 3; /*(/ 8)*/
l_remaining = l_img_comp->prec & 7; /* (%8) */
if(l_remaining) {
++l_size_comp;
}
if (l_size_comp == 3) {
l_size_comp = 4;
}
l_res = l_tile_comp->resolutions + l_tile_comp->minimum_num_resolutions - 1;
l_data_size += l_size_comp * (OPJ_UINT32)((l_res->x1 - l_res->x0) * (l_res->y1 - l_res->y0));
++l_img_comp;
++l_tile_comp;
}
return l_data_size;
}
| 0
|
102,226
|
int snd_interval_ratnum(struct snd_interval *i,
unsigned int rats_count, const struct snd_ratnum *rats,
unsigned int *nump, unsigned int *denp)
{
unsigned int best_num, best_den;
int best_diff;
unsigned int k;
struct snd_interval t;
int err;
unsigned int result_num, result_den;
int result_diff;
best_num = best_den = best_diff = 0;
for (k = 0; k < rats_count; ++k) {
unsigned int num = rats[k].num;
unsigned int den;
unsigned int q = i->min;
int diff;
if (q == 0)
q = 1;
den = div_up(num, q);
if (den < rats[k].den_min)
continue;
if (den > rats[k].den_max)
den = rats[k].den_max;
else {
unsigned int r;
r = (den - rats[k].den_min) % rats[k].den_step;
if (r != 0)
den -= r;
}
diff = num - q * den;
if (diff < 0)
diff = -diff;
if (best_num == 0 ||
diff * best_den < best_diff * den) {
best_diff = diff;
best_den = den;
best_num = num;
}
}
if (best_den == 0) {
i->empty = 1;
return -EINVAL;
}
t.min = div_down(best_num, best_den);
t.openmin = !!(best_num % best_den);
result_num = best_num;
result_diff = best_diff;
result_den = best_den;
best_num = best_den = best_diff = 0;
for (k = 0; k < rats_count; ++k) {
unsigned int num = rats[k].num;
unsigned int den;
unsigned int q = i->max;
int diff;
if (q == 0) {
i->empty = 1;
return -EINVAL;
}
den = div_down(num, q);
if (den > rats[k].den_max)
continue;
if (den < rats[k].den_min)
den = rats[k].den_min;
else {
unsigned int r;
r = (den - rats[k].den_min) % rats[k].den_step;
if (r != 0)
den += rats[k].den_step - r;
}
diff = q * den - num;
if (diff < 0)
diff = -diff;
if (best_num == 0 ||
diff * best_den < best_diff * den) {
best_diff = diff;
best_den = den;
best_num = num;
}
}
if (best_den == 0) {
i->empty = 1;
return -EINVAL;
}
t.max = div_up(best_num, best_den);
t.openmax = !!(best_num % best_den);
t.integer = 0;
err = snd_interval_refine(i, &t);
if (err < 0)
return err;
if (snd_interval_single(i)) {
if (best_diff * result_den < result_diff * best_den) {
result_num = best_num;
result_den = best_den;
}
if (nump)
*nump = result_num;
if (denp)
*denp = result_den;
}
return err;
}
| 0
|
211,976
|
ALuint S_AL_Format(int width, int channels)
{
ALuint format = AL_FORMAT_MONO16;
if(width == 1)
{
if(channels == 1)
format = AL_FORMAT_MONO8;
else if(channels == 2)
format = AL_FORMAT_STEREO8;
}
else if(width == 2)
{
if(channels == 1)
format = AL_FORMAT_MONO16;
else if(channels == 2)
format = AL_FORMAT_STEREO16;
}
return format;
}
| 0
|
443,808
|
static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
unsigned long old_addr, unsigned long old_end,
struct vm_area_struct *new_vma, pmd_t *new_pmd,
unsigned long new_addr, bool need_rmap_locks)
{
struct mm_struct *mm = vma->vm_mm;
pte_t *old_pte, *new_pte, pte;
spinlock_t *old_ptl, *new_ptl;
bool force_flush = false;
unsigned long len = old_end - old_addr;
/*
* When need_rmap_locks is true, we take the i_mmap_rwsem and anon_vma
* locks to ensure that rmap will always observe either the old or the
* new ptes. This is the easiest way to avoid races with
* truncate_pagecache(), page migration, etc...
*
* When need_rmap_locks is false, we use other ways to avoid
* such races:
*
* - During exec() shift_arg_pages(), we use a specially tagged vma
* which rmap call sites look for using vma_is_temporary_stack().
*
* - During mremap(), new_vma is often known to be placed after vma
* in rmap traversal order. This ensures rmap will always observe
* either the old pte, or the new pte, or both (the page table locks
* serialize access to individual ptes, but only rmap traversal
* order guarantees that we won't miss both the old and new ptes).
*/
if (need_rmap_locks)
take_rmap_locks(vma);
/*
* We don't have to worry about the ordering of src and dst
* pte locks because exclusive mmap_sem prevents deadlock.
*/
old_pte = pte_offset_map_lock(mm, old_pmd, old_addr, &old_ptl);
new_pte = pte_offset_map(new_pmd, new_addr);
new_ptl = pte_lockptr(mm, new_pmd);
if (new_ptl != old_ptl)
spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
flush_tlb_batched_pending(vma->vm_mm);
arch_enter_lazy_mmu_mode();
for (; old_addr < old_end; old_pte++, old_addr += PAGE_SIZE,
new_pte++, new_addr += PAGE_SIZE) {
if (pte_none(*old_pte))
continue;
pte = ptep_get_and_clear(mm, old_addr, old_pte);
/*
* If we are remapping a valid PTE, make sure
* to flush TLB before we drop the PTL for the
* PTE.
*
* NOTE! Both old and new PTL matter: the old one
* for racing with page_mkclean(), the new one to
* make sure the physical page stays valid until
* the TLB entry for the old mapping has been
* flushed.
*/
if (pte_present(pte))
force_flush = true;
pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
pte = move_soft_dirty_pte(pte);
set_pte_at(mm, new_addr, new_pte, pte);
}
arch_leave_lazy_mmu_mode();
if (force_flush)
flush_tlb_range(vma, old_end - len, old_end);
if (new_ptl != old_ptl)
spin_unlock(new_ptl);
pte_unmap(new_pte - 1);
pte_unmap_unlock(old_pte - 1, old_ptl);
if (need_rmap_locks)
drop_rmap_locks(vma);
}
| 0
|
23,340
|
static int dissect_h245_H2250MaximumSkewIndication ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_H2250MaximumSkewIndication , H2250MaximumSkewIndication_sequence ) ;
return offset ;
}
| 0
|
147,657
|
sort_page_names (gconstpointer a,
gconstpointer b)
{
gchar *temp1, *temp2;
gint ret;
temp1 = g_utf8_collate_key_for_filename (* (const char **) a, -1);
temp2 = g_utf8_collate_key_for_filename (* (const char **) b, -1);
ret = strcmp (temp1, temp2);
g_free (temp1);
g_free (temp2);
return ret;
}
| 0
|
405,485
|
static void setup_per_zone_lowmem_reserve(void)
{
struct pglist_data *pgdat;
enum zone_type j, idx;
for_each_online_pgdat(pgdat) {
for (j = 0; j < MAX_NR_ZONES; j++) {
struct zone *zone = pgdat->node_zones + j;
unsigned long managed_pages = zone->managed_pages;
zone->lowmem_reserve[j] = 0;
idx = j;
while (idx) {
struct zone *lower_zone;
idx--;
if (sysctl_lowmem_reserve_ratio[idx] < 1)
sysctl_lowmem_reserve_ratio[idx] = 1;
lower_zone = pgdat->node_zones + idx;
lower_zone->lowmem_reserve[j] = managed_pages /
sysctl_lowmem_reserve_ratio[idx];
managed_pages += lower_zone->managed_pages;
}
}
}
/* update totalreserve_pages */
calculate_totalreserve_pages();
}
| 0
|
484,440
|
int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
{
struct vcpu_svm *svm = to_svm(vcpu);
u64 old_efer = vcpu->arch.efer;
vcpu->arch.efer = efer;
if (!npt_enabled) {
/* Shadow paging assumes NX to be available. */
efer |= EFER_NX;
if (!(efer & EFER_LMA))
efer &= ~EFER_LME;
}
if ((old_efer & EFER_SVME) != (efer & EFER_SVME)) {
if (!(efer & EFER_SVME)) {
svm_leave_nested(vcpu);
svm_set_gif(svm, true);
/* #GP intercept is still needed for vmware backdoor */
if (!enable_vmware_backdoor)
clr_exception_intercept(svm, GP_VECTOR);
/*
* Free the nested guest state, unless we are in SMM.
* In this case we will return to the nested guest
* as soon as we leave SMM.
*/
if (!is_smm(vcpu))
svm_free_nested(svm);
} else {
int ret = svm_allocate_nested(svm);
if (ret) {
vcpu->arch.efer = old_efer;
return ret;
}
/*
* Never intercept #GP for SEV guests, KVM can't
* decrypt guest memory to workaround the erratum.
*/
if (svm_gp_erratum_intercept && !sev_guest(vcpu->kvm))
set_exception_intercept(svm, GP_VECTOR);
}
}
svm->vmcb->save.efer = efer | EFER_SVME;
vmcb_mark_dirty(svm->vmcb, VMCB_CR);
return 0;
}
| 0
|
112,582
|
static int create_pin_file(const sc_path_t *inpath, int chv, const char *key_id)
{
char prompt[40], *pin, *puk;
char buf[30], *p = buf;
sc_path_t file_id, path;
sc_file_t *file;
size_t len;
int r;
file_id = *inpath;
if (file_id.len < 2)
return -1;
if (chv == 1)
sc_format_path("I0000", &file_id);
else if (chv == 2)
sc_format_path("I0100", &file_id);
else
return -1;
r = sc_select_file(card, inpath, NULL);
if (r)
return -1;
r = sc_select_file(card, &file_id, NULL);
if (r == 0)
return 0;
sprintf(prompt, "Please enter CHV%d%s: ", chv, key_id);
pin = getpin(prompt);
if (pin == NULL)
return -1;
sprintf(prompt, "Please enter PUK for CHV%d%s: ", chv, key_id);
puk = getpin(prompt);
if (puk == NULL) {
free(pin);
return -1;
}
memset(p, 0xFF, 3);
p += 3;
memcpy(p, pin, 8);
p += 8;
*p++ = opt_pin_attempts;
*p++ = opt_pin_attempts;
memcpy(p, puk, 8);
p += 8;
*p++ = opt_puk_attempts;
*p++ = opt_puk_attempts;
len = p - buf;
free(pin);
free(puk);
file = sc_file_new();
file->type = SC_FILE_TYPE_WORKING_EF;
file->ef_structure = SC_FILE_EF_TRANSPARENT;
sc_file_add_acl_entry(file, SC_AC_OP_READ, SC_AC_NEVER, SC_AC_KEY_REF_NONE);
if (inpath->len == 2 && inpath->value[0] == 0x3F &&
inpath->value[1] == 0x00)
sc_file_add_acl_entry(file, SC_AC_OP_UPDATE, SC_AC_AUT, 1);
else
sc_file_add_acl_entry(file, SC_AC_OP_UPDATE, SC_AC_CHV, 2);
sc_file_add_acl_entry(file, SC_AC_OP_INVALIDATE, SC_AC_AUT, 1);
sc_file_add_acl_entry(file, SC_AC_OP_REHABILITATE, SC_AC_AUT, 1);
file->size = len;
file->id = (file_id.value[0] << 8) | file_id.value[1];
r = sc_create_file(card, file);
sc_file_free(file);
if (r) {
fprintf(stderr, "PIN file creation failed: %s\n", sc_strerror(r));
return r;
}
path = *inpath;
sc_append_path(&path, &file_id);
r = sc_select_file(card, &path, NULL);
if (r) {
fprintf(stderr, "Unable to select created PIN file: %s\n", sc_strerror(r));
return r;
}
r = sc_update_binary(card, 0, (const u8 *) buf, len, 0);
if (r < 0) {
fprintf(stderr, "Unable to update created PIN file: %s\n", sc_strerror(r));
return r;
}
return 0;
}
| 0
|
500,104
|
static void test05(char const* infile,
char const* password,
char const* outfile,
char const* outfile2)
{
qpdf_read(qpdf, infile, password);
qpdf_init_write(qpdf, outfile);
qpdf_set_static_ID(qpdf, QPDF_TRUE);
qpdf_set_linearization(qpdf, QPDF_TRUE);
qpdf_write(qpdf);
report_errors();
}
| 0
|
232,808
|
void TreeView::StartEditing(TreeModelNode* node) {
DCHECK(node && tree_view_);
CancelEdit();
if (model_->GetParent(node))
Expand(model_->GetParent(node));
const NodeDetails* details = GetNodeDetails(node);
SetFocus(tree_view_);
SetSelectedNode(node);
TreeView_EditLabel(tree_view_, details->tree_item);
}
| 0
|
448,180
|
int netns_identify_pid(const char *pidstr, char *name, int len)
{
char net_path[PATH_MAX];
int netns;
struct stat netst;
DIR *dir;
struct dirent *entry;
name[0] = '\0';
snprintf(net_path, sizeof(net_path), "/proc/%s/ns/net", pidstr);
netns = open(net_path, O_RDONLY);
if (netns < 0) {
fprintf(stderr, "Cannot open network namespace: %s\n",
strerror(errno));
return -1;
}
if (fstat(netns, &netst) < 0) {
fprintf(stderr, "Stat of netns failed: %s\n",
strerror(errno));
return -1;
}
dir = opendir(NETNS_RUN_DIR);
if (!dir) {
/* Succeed treat a missing directory as an empty directory */
if (errno == ENOENT)
return 0;
fprintf(stderr, "Failed to open directory %s:%s\n",
NETNS_RUN_DIR, strerror(errno));
return -1;
}
while ((entry = readdir(dir))) {
char name_path[PATH_MAX];
struct stat st;
if (strcmp(entry->d_name, ".") == 0)
continue;
if (strcmp(entry->d_name, "..") == 0)
continue;
snprintf(name_path, sizeof(name_path), "%s/%s", NETNS_RUN_DIR,
entry->d_name);
if (stat(name_path, &st) != 0)
continue;
if ((st.st_dev == netst.st_dev) &&
(st.st_ino == netst.st_ino)) {
strlcpy(name, entry->d_name, len);
}
}
closedir(dir);
return 0;
}
| 0
|
365,919
|
static inline struct sigqueue *get_task_cache(struct task_struct *t)
{
return NULL;
}
| 0
|
360,992
|
gs_window_real_unrealize (GtkWidget *widget)
{
g_signal_handlers_disconnect_by_func (gtk_window_get_screen (GTK_WINDOW (widget)),
screen_size_changed,
widget);
if (GTK_WIDGET_CLASS (gs_window_parent_class)->unrealize) {
GTK_WIDGET_CLASS (gs_window_parent_class)->unrealize (widget);
}
}
| 0
|
494,149
|
rapidjson::CrtAllocator &GetAllocator() { return s_CrtAllocator; }
| 0
|
96,546
|
TEST_P(SslSocketTest, GetNoUriWithDnsSan) {
const std::string client_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"
)EOF";
const std::string server_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem"
validation_context:
trusted_ca:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
)EOF";
// The SAN field only has DNS, expect "" for uriSanPeerCertificate().
TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam());
testUtil(test_options.setExpectedSerialNumber(TEST_SAN_DNS_CERT_SERIAL));
}
| 0
|
33,139
|
size_t coolkey_list_meter(const void *el) {
return sizeof(sc_cardctl_coolkey_object_t);
}
| 0
|
499,251
|
static av_cold void flush(AVCodecContext *avctx)
{
ALSDecContext *ctx = avctx->priv_data;
ctx->frame_id = 0;
}
| 0
|
245,221
|
ofputil_decode_ofp11_table_stats(struct ofpbuf *msg,
struct ofputil_table_stats *stats,
struct ofputil_table_features *features)
{
struct ofp11_table_stats *ots;
ots = ofpbuf_try_pull(msg, sizeof *ots);
if (!ots) {
return OFPERR_OFPBRC_BAD_LEN;
}
features->table_id = ots->table_id;
ovs_strlcpy(features->name, ots->name, sizeof features->name);
features->max_entries = ntohl(ots->max_entries);
features->nonmiss.instructions = ovsinst_bitmap_from_openflow(
ots->instructions, OFP11_VERSION);
features->nonmiss.write.ofpacts = ofpact_bitmap_from_openflow(
ots->write_actions, OFP11_VERSION);
features->nonmiss.apply.ofpacts = ofpact_bitmap_from_openflow(
ots->write_actions, OFP11_VERSION);
features->miss = features->nonmiss;
features->miss_config = ofputil_decode_table_miss(ots->config,
OFP11_VERSION);
features->match = mf_bitmap_from_of11(ots->match);
features->wildcard = mf_bitmap_from_of11(ots->wildcards);
bitmap_or(features->match.bm, features->wildcard.bm, MFF_N_IDS);
stats->table_id = ots->table_id;
stats->active_count = ntohl(ots->active_count);
stats->lookup_count = ntohll(ots->lookup_count);
stats->matched_count = ntohll(ots->matched_count);
return 0;
}
| 0
|
262,130
|
njs_generate_cond_expression_true(njs_vm_t *vm, njs_generator_t *generator,
njs_parser_node_t *node)
{
njs_int_t ret;
njs_jump_off_t jump_offset;
njs_parser_node_t *branch;
njs_vmcode_move_t *move;
njs_vmcode_jump_t *jump;
branch = node->right;
/*
* Branches usually uses node->index as destination, however,
* if branch expression is a literal, variable or assignment,
* then a MOVE operation is required.
*/
if (node->index != branch->left->index) {
njs_generate_code_move(generator, move, node->index,
branch->left->index, node);
}
ret = njs_generate_node_index_release(vm, generator, branch->left);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
njs_generate_code_jump(generator, jump, 0);
jump_offset = njs_code_offset(generator, jump);
njs_code_set_jump_offset(generator, njs_vmcode_cond_jump_t,
*((njs_jump_off_t *) generator->context));
njs_generator_next(generator, njs_generate, branch->right);
return njs_generator_after(vm, generator,
njs_queue_first(&generator->stack), node,
njs_generate_cond_expression_false,
&jump_offset, sizeof(njs_jump_off_t));
}
| 0
|
328,546
|
static int xen_remove_from_physmap(XenIOState *state,
hwaddr start_addr,
ram_addr_t size)
{
unsigned long i = 0;
int rc = 0;
XenPhysmap *physmap = NULL;
hwaddr phys_offset = 0;
physmap = get_physmapping(state, start_addr, size);
if (physmap == NULL) {
return -1;
}
phys_offset = physmap->phys_offset;
size = physmap->size;
DPRINTF("unmapping vram to %"HWADDR_PRIx" - %"HWADDR_PRIx", at "
"%"HWADDR_PRIx"\n", start_addr, start_addr + size, phys_offset);
size >>= TARGET_PAGE_BITS;
start_addr >>= TARGET_PAGE_BITS;
phys_offset >>= TARGET_PAGE_BITS;
for (i = 0; i < size; i++) {
unsigned long idx = start_addr + i;
xen_pfn_t gpfn = phys_offset + i;
rc = xc_domain_add_to_physmap(xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn);
if (rc) {
fprintf(stderr, "add_to_physmap MFN %"PRI_xen_pfn" to PFN %"
PRI_xen_pfn" failed: %d\n", idx, gpfn, rc);
return -rc;
}
}
QLIST_REMOVE(physmap, list);
if (state->log_for_dirtybit == physmap) {
state->log_for_dirtybit = NULL;
}
g_free(physmap);
return 0;
}
| 0
|
126,215
|
void CoreUserInputHandler::handleVoice(const BufferInfo &bufferInfo, const QString &msg)
{
QStringList nicks = msg.split(' ', QString::SkipEmptyParts);
QString m = "+"; for (int i = 0; i < nicks.count(); i++) m += 'v';
QStringList params;
params << bufferInfo.bufferName() << m << nicks;
emit putCmd("MODE", serverEncode(params));
}
| 0
|
499,376
|
static void reset_session(sasl_session_t *p)
{
if (p->mechptr && p->mechptr->mech_finish)
p->mechptr->mech_finish(p);
p->mechptr = NULL;
}
| 0
|
158,175
|
void CLASS ciff_block_1030()
{
static const ushort key[] = { 0x410, 0x45f3 };
int i, bpp, row, col, vbits=0;
unsigned long bitbuf=0;
if ((get2(),get4()) != 0x80008 || !get4()) return;
bpp = get2();
if (bpp != 10 && bpp != 12) return;
for (i=row=0; row < 8; row++)
for (col=0; col < 8; col++) {
if (vbits < bpp) {
bitbuf = bitbuf << 16 | (get2() ^ key[i++ & 1]);
vbits += 16;
}
white[row][col] =
bitbuf << (LONG_BIT - vbits) >> (LONG_BIT - bpp);
vbits -= bpp;
}
}
| 0
|
196,347
|
GahpClient::check_pending_timeout(const char *,const char *)
{
if ( pending_reqid == 0 ) {
return false;
}
if ( pending_submitted_to_gahp == false ) {
return false;
}
if ( pending_timeout && (time(NULL) > pending_timeout) ) {
clear_pending(); // we no longer want to hear about it...
return true;
}
return false;
}
| 0
|
286,328
|
void CastDetailedView::AppendSettingsEntries() {
const bool userAddingRunning = Shell::GetInstance()
->session_state_delegate()
->IsInSecondaryLoginScreen();
if (login_ == user::LOGGED_IN_NONE || login_ == user::LOGGED_IN_LOCKED ||
userAddingRunning)
return;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
HoverHighlightView* container = new HoverHighlightView(this);
container->AddLabel(rb.GetLocalizedString(IDS_ASH_STATUS_TRAY_CAST_OPTIONS),
gfx::ALIGN_LEFT, false /* highlight */);
AddChildView(container);
options_ = container;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.