idx
int64 | func
string | target
int64 |
|---|---|---|
491,217
|
TPMU_SENSITIVE_COMPOSITE_Unmarshal(TPMU_SENSITIVE_COMPOSITE *target, BYTE **buffer, INT32 *size, UINT32 selector)
{
TPM_RC rc = TPM_RC_SUCCESS;
switch (selector) {
#if ALG_RSA
case TPM_ALG_RSA:
rc = TPM2B_PRIVATE_KEY_RSA_Unmarshal(&target->rsa, buffer, size);
break;
#endif
#if ALG_ECC
case TPM_ALG_ECC:
rc = TPM2B_ECC_PARAMETER_Unmarshal(&target->ecc, buffer, size);
break;
#endif
#if ALG_KEYEDHASH
case TPM_ALG_KEYEDHASH:
rc = TPM2B_SENSITIVE_DATA_Unmarshal(&target->bits, buffer, size);
break;
#endif
#if ALG_SYMCIPHER
case TPM_ALG_SYMCIPHER:
rc = TPM2B_SYM_KEY_Unmarshal(&target->sym, buffer, size);
break;
#endif
default:
rc = TPM_RC_SELECTOR;
}
return rc;
}
| 0
|
160,948
|
node_char_len1(Node* node, regex_t* reg, MinMaxCharLen* ci, ScanEnv* env,
int level)
{
MinMaxCharLen tci;
int r = CHAR_LEN_NORMAL;
level++;
switch (NODE_TYPE(node)) {
case NODE_LIST:
{
int first = TRUE;
do {
r = node_char_len1(NODE_CAR(node), reg, &tci, env, level);
if (r < 0) break;
if (first == TRUE) {
*ci = tci;
first = FALSE;
}
else
mmcl_add(ci, &tci);
} while (IS_NOT_NULL(node = NODE_CDR(node)));
}
break;
case NODE_ALT:
{
int fixed;
r = node_char_len1(NODE_CAR(node), reg, ci, env, level);
if (r < 0) break;
fixed = TRUE;
while (IS_NOT_NULL(node = NODE_CDR(node))) {
r = node_char_len1(NODE_CAR(node), reg, &tci, env, level);
if (r < 0) break;
if (! mmcl_fixed(&tci))
fixed = FALSE;
mmcl_alt_merge(ci, &tci);
}
if (r < 0) break;
r = CHAR_LEN_NORMAL;
if (mmcl_fixed(ci)) break;
if (fixed == TRUE && level == 1) {
r = CHAR_LEN_TOP_ALT_FIXED;
}
}
break;
case NODE_STRING:
{
OnigLen clen;
StrNode* sn = STR_(node);
UChar *s = sn->s;
if (NODE_IS_IGNORECASE(node) && ! NODE_STRING_IS_CRUDE(node)) {
/* Such a case is possible.
ex. /(?i)(?<=\1)(a)/
Backref node refer to capture group, but it doesn't tune yet.
*/
r = ONIGERR_INVALID_LOOK_BEHIND_PATTERN;
break;
}
clen = 0;
while (s < sn->end) {
s += enclen(reg->enc, s);
clen = distance_add(clen, 1);
}
mmcl_set(ci, clen);
}
break;
case NODE_QUANT:
{
QuantNode* qn = QUANT_(node);
if (qn->lower == qn->upper) {
if (qn->upper == 0) {
mmcl_set(ci, 0);
}
else {
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
if (r < 0) break;
mmcl_multiply(ci, qn->lower);
}
}
else {
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
if (r < 0) break;
mmcl_repeat_range_multiply(ci, qn->lower, qn->upper);
}
}
break;
#ifdef USE_CALL
case NODE_CALL:
if (NODE_IS_RECURSION(node))
mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE);
else
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
break;
#endif
case NODE_CTYPE:
case NODE_CCLASS:
mmcl_set(ci, 1);
break;
case NODE_BAG:
{
BagNode* en = BAG_(node);
switch (en->type) {
case BAG_MEMORY:
if (NODE_IS_FIXED_CLEN(node)) {
mmcl_set_min_max(ci, en->min_char_len, en->max_char_len,
NODE_IS_FIXED_CLEN_MIN_SURE(node));
}
else {
if (NODE_IS_MARK1(node)) {
mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE);
}
else {
NODE_STATUS_ADD(node, MARK1);
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
NODE_STATUS_REMOVE(node, MARK1);
if (r < 0) break;
en->min_char_len = ci->min;
en->max_char_len = ci->max;
NODE_STATUS_ADD(node, FIXED_CLEN);
if (ci->min_is_sure != FALSE)
NODE_STATUS_ADD(node, FIXED_CLEN_MIN_SURE);
}
}
/* can't optimize look-behind if capture exists. */
ci->min_is_sure = FALSE;
break;
case BAG_OPTION:
case BAG_STOP_BACKTRACK:
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
break;
case BAG_IF_ELSE:
{
MinMaxCharLen eci;
r = node_char_len1(NODE_BODY(node), reg, ci, env, level);
if (r < 0) break;
if (IS_NOT_NULL(en->te.Then)) {
r = node_char_len1(en->te.Then, reg, &tci, env, level);
if (r < 0) break;
mmcl_add(ci, &tci);
}
if (IS_NOT_NULL(en->te.Else)) {
r = node_char_len1(en->te.Else, reg, &eci, env, level);
if (r < 0) break;
}
else {
mmcl_set(&eci, 0);
}
mmcl_alt_merge(ci, &eci);
}
break;
default: /* never come here */
r = ONIGERR_PARSER_BUG;
break;
}
}
break;
case NODE_GIMMICK:
mmcl_set(ci, 0);
break;
case NODE_ANCHOR:
zero:
mmcl_set(ci, 0);
/* can't optimize look-behind if anchor exists. */
ci->min_is_sure = FALSE;
break;
case NODE_BACKREF:
if (NODE_IS_CHECKER(node))
goto zero;
if (NODE_IS_RECURSION(node)) {
#ifdef USE_BACKREF_WITH_LEVEL
if (NODE_IS_NEST_LEVEL(node)) {
mmcl_set_min_max(ci, 0, INFINITE_LEN, FALSE);
break;
}
#endif
mmcl_set_min_max(ci, 0, 0, FALSE);
break;
}
{
int i;
int* backs;
MemEnv* mem_env = SCANENV_MEMENV(env);
BackRefNode* br = BACKREF_(node);
backs = BACKREFS_P(br);
r = node_char_len1(mem_env[backs[0]].mem_node, reg, ci, env, level);
if (r < 0) break;
if (! mmcl_fixed(ci)) ci->min_is_sure = FALSE;
for (i = 1; i < br->back_num; i++) {
r = node_char_len1(mem_env[backs[i]].mem_node, reg, &tci, env, level);
if (r < 0) break;
if (! mmcl_fixed(&tci)) tci.min_is_sure = FALSE;
mmcl_alt_merge(ci, &tci);
}
}
break;
default: /* never come here */
r = ONIGERR_PARSER_BUG;
break;
}
return r;
}
| 0
|
25,101
|
static int ir2_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
Ir2Context * const s = avctx -> priv_data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
AVFrame * picture = data ;
AVFrame * const p = & s -> picture ;
int start , ret ;
if ( ( ret = ff_reget_buffer ( avctx , p ) ) < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
start = 48 ;
if ( start >= buf_size ) {
av_log ( s -> avctx , AV_LOG_ERROR , "input buffer size too small (%d)\n" , buf_size ) ;
return AVERROR_INVALIDDATA ;
}
s -> decode_delta = buf [ 18 ] ;
# ifndef BITSTREAM_READER_LE for ( i = 0 ;
i < buf_size ;
i ++ ) buf [ i ] = ff_reverse [ buf [ i ] ] ;
# endif init_get_bits ( & s -> gb , buf + start , ( buf_size - start ) * 8 ) ;
if ( s -> decode_delta ) {
if ( ( ret = ir2_decode_plane ( s , avctx -> width , avctx -> height , s -> picture . data [ 0 ] , s -> picture . linesize [ 0 ] , ir2_luma_table ) ) < 0 ) return ret ;
if ( ( ret = ir2_decode_plane ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 2 ] , s -> picture . linesize [ 2 ] , ir2_luma_table ) ) < 0 ) return ret ;
if ( ( ret = ir2_decode_plane ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 1 ] , s -> picture . linesize [ 1 ] , ir2_luma_table ) ) < 0 ) return ret ;
}
else {
if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width , avctx -> height , s -> picture . data [ 0 ] , s -> picture . linesize [ 0 ] , ir2_luma_table ) ) < 0 ) return ret ;
if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 2 ] , s -> picture . linesize [ 2 ] , ir2_luma_table ) ) < 0 ) return ret ;
if ( ( ret = ir2_decode_plane_inter ( s , avctx -> width >> 2 , avctx -> height >> 2 , s -> picture . data [ 1 ] , s -> picture . linesize [ 1 ] , ir2_luma_table ) ) < 0 ) return ret ;
}
if ( ( ret = av_frame_ref ( picture , & s -> picture ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
}
| 0
|
74,916
|
void CLASS get_timestamp(int reversed)
{
struct tm t;
char str[20];
int i;
str[19] = 0;
if (reversed)
for (i = 19; i--;)
str[i] = fgetc(ifp);
else
fread(str, 19, 1, ifp);
memset(&t, 0, sizeof t);
if (sscanf(str, "%d:%d:%d %d:%d:%d", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, &t.tm_sec) != 6)
return;
t.tm_year -= 1900;
t.tm_mon -= 1;
t.tm_isdst = -1;
if (mktime(&t) > 0)
timestamp = mktime(&t);
}
| 0
|
42,998
|
void ireftype_box_del(GF_Box *s)
{
GF_ItemReferenceTypeBox *ptr = (GF_ItemReferenceTypeBox *)s;
if (!ptr) return;
if (ptr->to_item_IDs) gf_free(ptr->to_item_IDs);
gf_free(ptr);
}
| 0
|
227,479
|
static void ctdb_listen_event(struct event_context *ev, struct fd_event *fde,
uint16_t flags, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data, struct ctdb_tcp);
ctdb_sock_addr addr;
socklen_t len;
int fd, nodeid;
struct ctdb_incoming *in;
int one = 1;
const char *incoming_node;
memset(&addr, 0, sizeof(addr));
len = sizeof(addr);
fd = accept(ctcp->listen_fd, (struct sockaddr *)&addr, &len);
if (fd == -1) return;
incoming_node = ctdb_addr_to_str(&addr);
nodeid = ctdb_ip_to_nodeid(ctdb, incoming_node);
if (nodeid == -1) {
DEBUG(DEBUG_ERR, ("Refused connection from unknown node %s\n", incoming_node));
close(fd);
return;
}
in = talloc_zero(ctcp, struct ctdb_incoming);
in->fd = fd;
in->ctdb = ctdb;
set_nonblocking(in->fd);
set_close_on_exec(in->fd);
DEBUG(DEBUG_DEBUG, (__location__ " Created SOCKET FD:%d to incoming ctdb connection\n", fd));
setsockopt(in->fd,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(one));
in->queue = ctdb_queue_setup(ctdb, in, in->fd, CTDB_TCP_ALIGNMENT,
ctdb_tcp_read_cb, in, "ctdbd-%s", incoming_node);
}
| 0
|
490,861
|
void io_start_multiplex_out(int fd)
{
io_flush(FULL_FLUSH);
if (msgs2stderr == 1 && DEBUG_GTE(IO, 2))
rprintf(FINFO, "[%s] io_start_multiplex_out(%d)\n", who_am_i(), fd);
if (!iobuf.msg.buf)
alloc_xbuf(&iobuf.msg, ROUND_UP_1024(IO_BUFFER_SIZE));
iobuf.out_empty_len = 4; /* See also OUT_MULTIPLEXED */
io_start_buffering_out(fd);
got_kill_signal = 0;
iobuf.raw_data_header_pos = iobuf.out.pos + iobuf.out.len;
iobuf.out.len += 4;
}
| 0
|
319,875
|
int main(void)
{
int nf;
Suite *s;
SRunner *sr;
s = qfloat_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
nf = srunner_ntests_failed(sr);
srunner_free(sr);
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
| 0
|
353,857
|
static void test_json_append_escaped_data(void)
{
static const unsigned char test_input[] =
"\b\f\r\n\t\"\\\000\001\002-\xC3\xA4\xf0\x90\x90\xb7";
string_t *str = t_str_new(32);
test_begin("json_append_escaped()");
json_append_escaped_data(str, test_input, sizeof(test_input)-1);
test_assert(strcmp(str_c(str), "\\b\\f\\r\\n\\t\\\"\\\\\\u0000\\u0001\\u0002-\\u00e4\\ud801\\udc37") == 0);
test_end();
}
| 1
|
488,551
|
free_toporder_info (class ipa_topo_info *topo)
{
ipa_free_postorder_info ();
free (topo->order);
free (topo->stack);
}
| 0
|
519,778
|
select_result_interceptor(THD *thd_arg):
select_result(thd_arg), suppress_my_ok(false)
{
DBUG_ENTER("select_result_interceptor::select_result_interceptor");
DBUG_PRINT("enter", ("this %p", this));
DBUG_VOID_RETURN;
} /* Remove gcc warning */
| 0
|
496,897
|
int mempool_create_with_shared_mem(
size_t pool_item_size, size_t pool_initial_size, size_t pool_expansion_size,
func_mem_available_callback_type mem_get_free_space_func,
func_mark_mem_used_callback_type mem_mark_used_space_func,
func_mark_mem_free_callback_type mem_mark_free_space_func,
func_log_callback_type log_callback_func, int flags,
MemoryPoolHandle *p_handle) {
int rc = 0;
struct mempool *pool = NULL;
if (mem_get_free_space_func == NULL || mem_mark_used_space_func == NULL ||
mem_mark_free_space_func == NULL || p_handle == NULL) {
return S3_MEMPOOL_INVALID_ARG;
}
if (pool_initial_size > mem_get_free_space_func()) {
return S3_MEMPOOL_THRESHOLD_EXCEEDED;
}
rc = mempool_create(pool_item_size, pool_initial_size, pool_expansion_size, 0,
log_callback_func, flags, p_handle);
if (rc != 0) {
return rc;
}
pool = (struct mempool *)*p_handle;
pool->mem_get_free_space_func = mem_get_free_space_func;
pool->mem_mark_used_space_func = mem_mark_used_space_func;
pool->mem_mark_free_space_func = mem_mark_free_space_func;
/* Explicitly mark used space, since mempool_create -> freelist_allocate
dont have the function callbacks set. */
pool->mem_mark_used_space_func(pool->total_bufs_allocated_by_pool *
pool->mempool_item_size);
return 0;
}
| 0
|
405,676
|
WandExport void DrawRectangle(DrawingWand *wand,const double x1,const double y1,
const double x2,const double y2)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
(void) MVGPrintf(wand,"rectangle %.20g %.20g %.20g %.20g\n",x1,y1,x2,y2);
}
| 0
|
133,216
|
static bool xdp_is_valid_access(int off, int size,
enum bpf_access_type type,
const struct bpf_prog *prog,
struct bpf_insn_access_aux *info)
{
if (type == BPF_WRITE)
return false;
switch (off) {
case offsetof(struct xdp_md, data):
info->reg_type = PTR_TO_PACKET;
break;
case offsetof(struct xdp_md, data_meta):
info->reg_type = PTR_TO_PACKET_META;
break;
case offsetof(struct xdp_md, data_end):
info->reg_type = PTR_TO_PACKET_END;
break;
}
return __is_valid_xdp_access(off, size);
}
| 0
|
474,844
|
static int assign_proto_idx(struct proto *prot)
{
prot->inuse_idx = find_first_zero_bit(proto_inuse_idx, PROTO_INUSE_NR);
if (unlikely(prot->inuse_idx == PROTO_INUSE_NR - 1)) {
pr_err("PROTO_INUSE_NR exhausted\n");
return -ENOSPC;
}
set_bit(prot->inuse_idx, proto_inuse_idx);
return 0;
}
| 0
|
382,432
|
ProcReleaseLocks(bool isCommit)
{
if (!MyProc)
return;
/* If waiting, get off wait queue (should only be needed after error) */
LockErrorCleanup();
/* Release standard locks, including session-level if aborting */
LockReleaseAll(DEFAULT_LOCKMETHOD, !isCommit);
/* Release transaction-level advisory locks */
LockReleaseAll(USER_LOCKMETHOD, false);
}
| 0
|
265,610
|
QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items)
{
assertArray();
return dynamic_cast<QPDF_Array*>(obj.getPointer())->setFromVector(items);
}
| 0
|
355,303
|
int hrtimer_try_to_cancel(struct hrtimer *timer)
{
struct hrtimer_clock_base *base;
unsigned long flags;
int ret = -1;
base = lock_hrtimer_base(timer, &flags);
if (!hrtimer_callback_running(timer))
ret = remove_hrtimer(timer, base);
unlock_hrtimer_base(timer, &flags);
return ret;
}
| 0
|
413,753
|
addBackwardPassRule(TranslationTableOffset *newRuleOffset, TranslationTableRule *newRule,
TranslationTableHeader *table) {
TranslationTableOffset *currentOffsetPtr;
TranslationTableRule *currentRule;
switch (newRule->opcode) {
case CTO_Correct:
currentOffsetPtr = &table->backPassRules[0];
break;
case CTO_Context:
currentOffsetPtr = &table->backPassRules[1];
break;
case CTO_Pass2:
currentOffsetPtr = &table->backPassRules[2];
break;
case CTO_Pass3:
currentOffsetPtr = &table->backPassRules[3];
break;
case CTO_Pass4:
currentOffsetPtr = &table->backPassRules[4];
break;
default:
return 0;
}
while (*currentOffsetPtr) {
currentRule = (TranslationTableRule *)&table->ruleArea[*currentOffsetPtr];
if (newRule->charslen > currentRule->charslen) break;
currentOffsetPtr = ¤tRule->dotsnext;
}
newRule->dotsnext = *currentOffsetPtr;
*currentOffsetPtr = *newRuleOffset;
return 1;
}
| 0
|
9,250
|
void CL_Init( void ) {
Com_Printf( "----- Client Initialization -----\n" );
Con_Init();
if(!com_fullyInitialized)
{
CL_ClearState();
clc.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED
cl_oldGameSet = qfalse;
}
cls.realtime = 0;
CL_InitInput();
cl_noprint = Cvar_Get( "cl_noprint", "0", 0 );
#ifdef UPDATE_SERVER_NAME
cl_motd = Cvar_Get( "cl_motd", "1", 0 );
#endif
cl_autoupdate = Cvar_Get( "cl_autoupdate", "0", CVAR_ARCHIVE );
cl_timeout = Cvar_Get( "cl_timeout", "200", 0 );
cl_wavefilerecord = Cvar_Get( "cl_wavefilerecord", "0", CVAR_TEMP );
cl_timeNudge = Cvar_Get( "cl_timeNudge", "0", CVAR_TEMP );
cl_shownet = Cvar_Get( "cl_shownet", "0", CVAR_TEMP );
cl_shownuments = Cvar_Get( "cl_shownuments", "0", CVAR_TEMP );
cl_visibleClients = Cvar_Get( "cl_visibleClients", "0", CVAR_TEMP );
cl_showServerCommands = Cvar_Get( "cl_showServerCommands", "0", 0 );
cl_showSend = Cvar_Get( "cl_showSend", "0", CVAR_TEMP );
cl_showTimeDelta = Cvar_Get( "cl_showTimeDelta", "0", CVAR_TEMP );
cl_freezeDemo = Cvar_Get( "cl_freezeDemo", "0", CVAR_TEMP );
rcon_client_password = Cvar_Get( "rconPassword", "", CVAR_TEMP );
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
cl_timedemo = Cvar_Get( "timedemo", "0", 0 );
cl_timedemoLog = Cvar_Get ("cl_timedemoLog", "", CVAR_ARCHIVE);
cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
cl_avidemo = Cvar_Get( "cl_avidemo", "0", 0 );
cl_forceavidemo = Cvar_Get( "cl_forceavidemo", "0", 0 );
rconAddress = Cvar_Get( "rconAddress", "", 0 );
cl_yawspeed = Cvar_Get( "cl_yawspeed", "140", CVAR_ARCHIVE );
cl_pitchspeed = Cvar_Get( "cl_pitchspeed", "140", CVAR_ARCHIVE );
cl_anglespeedkey = Cvar_Get( "cl_anglespeedkey", "1.5", 0 );
cl_maxpackets = Cvar_Get( "cl_maxpackets", "38", CVAR_ARCHIVE );
cl_packetdup = Cvar_Get( "cl_packetdup", "1", CVAR_ARCHIVE );
cl_showPing = Cvar_Get( "cl_showPing", "0", CVAR_ARCHIVE );
cl_run = Cvar_Get( "cl_run", "1", CVAR_ARCHIVE );
cl_sensitivity = Cvar_Get( "sensitivity", "5", CVAR_ARCHIVE );
cl_mouseAccel = Cvar_Get( "cl_mouseAccel", "0", CVAR_ARCHIVE );
cl_freelook = Cvar_Get( "cl_freelook", "1", CVAR_ARCHIVE );
cl_mouseAccelStyle = Cvar_Get( "cl_mouseAccelStyle", "0", CVAR_ARCHIVE );
cl_mouseAccelOffset = Cvar_Get( "cl_mouseAccelOffset", "5", CVAR_ARCHIVE );
Cvar_CheckRange(cl_mouseAccelOffset, 0.001f, 50000.0f, qfalse);
cl_showMouseRate = Cvar_Get( "cl_showmouserate", "0", 0 );
cl_allowDownload = Cvar_Get( "cl_allowDownload", "1", CVAR_ARCHIVE );
#ifdef USE_CURL_DLOPEN
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE);
#endif
Cvar_Get( "cg_autoswitch", "0", CVAR_ARCHIVE );
Cvar_Get( "cg_wolfparticles", "1", CVAR_ARCHIVE );
cl_conXOffset = Cvar_Get( "cl_conXOffset", "0", 0 );
cl_inGameVideo = Cvar_Get( "r_inGameVideo", "1", CVAR_ARCHIVE );
cl_serverStatusResendTime = Cvar_Get( "cl_serverStatusResendTime", "750", 0 );
cl_recoilPitch = Cvar_Get( "cg_recoilPitch", "0", CVAR_ROM );
cl_bypassMouseInput = Cvar_Get( "cl_bypassMouseInput", "0", 0 ); //CVAR_ROM ); // NERVE - SMF
m_pitch = Cvar_Get( "m_pitch", "0.022", CVAR_ARCHIVE );
m_yaw = Cvar_Get( "m_yaw", "0.022", CVAR_ARCHIVE );
m_forward = Cvar_Get( "m_forward", "0.25", CVAR_ARCHIVE );
m_side = Cvar_Get( "m_side", "0.25", CVAR_ARCHIVE );
m_filter = Cvar_Get( "m_filter", "0", CVAR_ARCHIVE );
j_pitch = Cvar_Get ("j_pitch", "0.022", CVAR_ARCHIVE);
j_yaw = Cvar_Get ("j_yaw", "-0.022", CVAR_ARCHIVE);
j_forward = Cvar_Get ("j_forward", "-0.25", CVAR_ARCHIVE);
j_side = Cvar_Get ("j_side", "0.25", CVAR_ARCHIVE);
j_up = Cvar_Get ("j_up", "0", CVAR_ARCHIVE);
j_pitch_axis = Cvar_Get ("j_pitch_axis", "3", CVAR_ARCHIVE);
j_yaw_axis = Cvar_Get ("j_yaw_axis", "2", CVAR_ARCHIVE);
j_forward_axis = Cvar_Get ("j_forward_axis", "1", CVAR_ARCHIVE);
j_side_axis = Cvar_Get ("j_side_axis", "0", CVAR_ARCHIVE);
j_up_axis = Cvar_Get ("j_up_axis", "4", CVAR_ARCHIVE);
Cvar_CheckRange(j_pitch_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue);
Cvar_CheckRange(j_yaw_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue);
Cvar_CheckRange(j_forward_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue);
Cvar_CheckRange(j_side_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue);
Cvar_CheckRange(j_up_axis, 0, MAX_JOYSTICK_AXIS-1, qtrue);
cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE );
cl_lanForcePackets = Cvar_Get ("cl_lanForcePackets", "1", CVAR_ARCHIVE);
cl_guid = Cvar_Get( "cl_guid", "unknown", CVAR_USERINFO | CVAR_ROM );
cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE);
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
Cvar_Get( "cg_drawCompass", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_drawNotifyText", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_quickMessageAlt", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_popupLimboMenu", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_descriptiveText", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_drawTeamOverlay", "2", CVAR_ARCHIVE );
Cvar_Get( "cg_uselessNostalgia", "0", CVAR_ARCHIVE ); // JPW NERVE
Cvar_Get( "cg_drawGun", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_cursorHints", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_voiceSpriteTime", "6000", CVAR_ARCHIVE );
Cvar_Get( "cg_teamChatsOnly", "0", CVAR_ARCHIVE );
Cvar_Get( "cg_noVoiceChats", "0", CVAR_ARCHIVE );
Cvar_Get( "cg_noVoiceText", "0", CVAR_ARCHIVE );
Cvar_Get( "cg_crosshairSize", "48", CVAR_ARCHIVE );
Cvar_Get( "cg_drawCrosshair", "1", CVAR_ARCHIVE );
Cvar_Get( "cg_zoomDefaultSniper", "20", CVAR_ARCHIVE );
Cvar_Get( "cg_zoomstepsniper", "2", CVAR_ARCHIVE );
Cvar_Get( "mp_playerType", "0", 0 );
Cvar_Get( "mp_currentPlayerType", "0", 0 );
Cvar_Get( "mp_weapon", "0", 0 );
Cvar_Get( "mp_team", "0", 0 );
Cvar_Get( "mp_currentTeam", "0", 0 );
Cvar_Get( "name", "WolfPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
cl_rate = Cvar_Get( "rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE ); // NERVE - SMF - changed from 3000
Cvar_Get( "snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "model", "multi", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "head", "default", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "color", "4", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "handicap", "100", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "sex", "male", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "cl_anonymous", "0", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "password", "", CVAR_USERINFO );
Cvar_Get( "cg_predictItems", "1", CVAR_USERINFO | CVAR_ARCHIVE );
#ifdef USE_MUMBLE
cl_useMumble = Cvar_Get ("cl_useMumble", "0", CVAR_ARCHIVE | CVAR_LATCH);
cl_mumbleScale = Cvar_Get ("cl_mumbleScale", "0.0254", CVAR_ARCHIVE);
#endif
#ifdef USE_VOIP
cl_voipSend = Cvar_Get ("cl_voipSend", "0", 0);
cl_voipSendTarget = Cvar_Get ("cl_voipSendTarget", "spatial", 0);
cl_voipGainDuringCapture = Cvar_Get ("cl_voipGainDuringCapture", "0.2", CVAR_ARCHIVE);
cl_voipCaptureMult = Cvar_Get ("cl_voipCaptureMult", "2.0", CVAR_ARCHIVE);
cl_voipUseVAD = Cvar_Get ("cl_voipUseVAD", "0", CVAR_ARCHIVE);
cl_voipVADThreshold = Cvar_Get ("cl_voipVADThreshold", "0.25", CVAR_ARCHIVE);
cl_voipShowMeter = Cvar_Get ("cl_voipShowMeter", "1", CVAR_ARCHIVE);
cl_voip = Cvar_Get ("cl_voip", "1", CVAR_ARCHIVE);
Cvar_CheckRange( cl_voip, 0, 1, qtrue );
cl_voipProtocol = Cvar_Get ("cl_voipProtocol", cl_voip->integer ? "opus" : "", CVAR_USERINFO | CVAR_ROM);
#endif
Cvar_Get( "cg_autoactivate", "1", CVAR_USERINFO | CVAR_ARCHIVE );
Cvar_Get( "cg_viewsize", "100", CVAR_ARCHIVE );
Cvar_Get ("cg_stereoSeparation", "0", CVAR_ROM);
Cvar_Get( "cg_autoReload", "1", CVAR_ARCHIVE | CVAR_USERINFO );
cl_missionStats = Cvar_Get( "g_missionStats", "0", CVAR_ROM );
cl_waitForFire = Cvar_Get( "cl_waitForFire", "0", CVAR_ROM );
cl_language = Cvar_Get( "cl_language", "0", CVAR_ARCHIVE );
cl_debugTranslation = Cvar_Get( "cl_debugTranslation", "0", 0 );
cl_updateavailable = Cvar_Get( "cl_updateavailable", "0", CVAR_ROM );
cl_updatefiles = Cvar_Get( "cl_updatefiles", "", CVAR_ROM );
Q_strncpyz( cls.autoupdateServerNames[0], AUTOUPDATE_SERVER1_NAME, MAX_QPATH );
Q_strncpyz( cls.autoupdateServerNames[1], AUTOUPDATE_SERVER2_NAME, MAX_QPATH );
Q_strncpyz( cls.autoupdateServerNames[2], AUTOUPDATE_SERVER3_NAME, MAX_QPATH );
Q_strncpyz( cls.autoupdateServerNames[3], AUTOUPDATE_SERVER4_NAME, MAX_QPATH );
Q_strncpyz( cls.autoupdateServerNames[4], AUTOUPDATE_SERVER5_NAME, MAX_QPATH );
Cmd_AddCommand( "cmd", CL_ForwardToServer_f );
Cmd_AddCommand( "configstrings", CL_Configstrings_f );
Cmd_AddCommand( "clientinfo", CL_Clientinfo_f );
Cmd_AddCommand( "snd_restart", CL_Snd_Restart_f );
Cmd_AddCommand( "vid_restart", CL_Vid_Restart_f );
Cmd_AddCommand( "ui_restart", CL_UI_Restart_f ); // NERVE - SMF
Cmd_AddCommand( "disconnect", CL_Disconnect_f );
Cmd_AddCommand( "record", CL_Record_f );
Cmd_AddCommand( "demo", CL_PlayDemo_f );
Cmd_SetCommandCompletionFunc( "demo", CL_CompleteDemoName );
Cmd_AddCommand( "cinematic", CL_PlayCinematic_f );
Cmd_AddCommand( "stoprecord", CL_StopRecord_f );
Cmd_AddCommand( "connect", CL_Connect_f );
Cmd_AddCommand( "reconnect", CL_Reconnect_f );
Cmd_AddCommand( "localservers", CL_LocalServers_f );
Cmd_AddCommand( "globalservers", CL_GlobalServers_f );
Cmd_AddCommand( "rcon", CL_Rcon_f );
Cmd_SetCommandCompletionFunc( "rcon", CL_CompleteRcon );
Cmd_AddCommand( "ping", CL_Ping_f );
Cmd_AddCommand( "serverstatus", CL_ServerStatus_f );
Cmd_AddCommand( "showip", CL_ShowIP_f );
Cmd_AddCommand( "fs_openedList", CL_OpenedPK3List_f );
Cmd_AddCommand( "fs_referencedList", CL_ReferencedPK3List_f );
Cmd_AddCommand ("video", CL_Video_f );
Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
Cmd_AddCommand( "cache_startgather", CL_Cache_StartGather_f );
Cmd_AddCommand( "cache_usedfile", CL_Cache_UsedFile_f );
Cmd_AddCommand( "cache_setindex", CL_Cache_SetIndex_f );
Cmd_AddCommand( "cache_mapchange", CL_Cache_MapChange_f );
Cmd_AddCommand( "cache_endgather", CL_Cache_EndGather_f );
Cmd_AddCommand( "updatehunkusage", CL_UpdateLevelHunkUsage );
Cmd_AddCommand( "updatescreen", SCR_UpdateScreen );
Cmd_AddCommand( "SaveTranslations", CL_SaveTranslations_f ); // NERVE - SMF - localization
Cmd_AddCommand( "SaveNewTranslations", CL_SaveNewTranslations_f ); // NERVE - SMF - localization
Cmd_AddCommand( "LoadTranslations", CL_LoadTranslations_f ); // NERVE - SMF - localization
Cmd_AddCommand( "startSingleplayer", CL_startSingleplayer_f ); // NERVE - SMF
Cmd_AddCommand( "setRecommended", CL_SetRecommended_f );
CL_InitRef();
SCR_Init();
Cvar_Set( "cl_running", "1" );
autoupdateChecked = qfalse;
autoupdateStarted = qfalse;
CL_InitTranslation(); // NERVE - SMF - localization
CL_GenerateQKey();
CL_UpdateGUID( NULL, 0 );
Com_Printf( "----- Client Initialization Complete -----\n" );
}
| 1
|
55,246
|
int setns(int fd, int nstype)
{
return syscall(SYS_setns, fd, nstype);
}
| 0
|
356,962
|
sctp_disposition_t sctp_sf_ootb(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 sk_buff *skb = chunk->skb;
sctp_chunkhdr_t *ch;
__u8 *ch_end;
int ootb_shut_ack = 0;
SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES);
ch = (sctp_chunkhdr_t *) chunk->chunk_hdr;
do {
/* Report violation if the chunk is less then minimal */
if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
/* Now that we know we at least have a chunk header,
* do things that are type appropriate.
*/
if (SCTP_CID_SHUTDOWN_ACK == ch->type)
ootb_shut_ack = 1;
/* RFC 2960, Section 3.3.7
* Moreover, under any circumstances, an endpoint that
* receives an ABORT MUST NOT respond to that ABORT by
* sending an ABORT of its own.
*/
if (SCTP_CID_ABORT == ch->type)
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
/* Report violation if chunk len overflows */
ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length));
if (ch_end > skb_tail_pointer(skb))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
ch = (sctp_chunkhdr_t *) ch_end;
} while (ch_end < skb_tail_pointer(skb));
if (ootb_shut_ack)
return sctp_sf_shut_8_4_5(ep, asoc, type, arg, commands);
else
return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
}
| 0
|
366,771
|
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
{
return do_sigaltstack(uss, uoss, rdusp());
}
| 0
|
292,527
|
vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp)
{
ff_visited_list_hdr_T *vp;
while (*list_headp != NULL)
{
vp = (*list_headp)->ffvl_next;
ff_free_visited_list((*list_headp)->ffvl_visited_list);
vim_free((*list_headp)->ffvl_filename);
vim_free(*list_headp);
*list_headp = vp;
}
*list_headp = NULL;
}
| 0
|
370,898
|
rb_to_id(VALUE name)
{
VALUE tmp;
ID id;
switch (TYPE(name)) {
default:
tmp = rb_check_string_type(name);
if (NIL_P(tmp)) {
tmp = rb_inspect(name);
rb_raise(rb_eTypeError, "%s is not a symbol",
RSTRING_PTR(tmp));
}
name = tmp;
/* fall through */
case T_STRING:
name = rb_str_intern(name);
/* fall through */
case T_SYMBOL:
return SYM2ID(name);
}
return id;
}
| 0
|
501,775
|
HealthCheckerFactoryContextImpl(Upstream::Cluster& cluster, Envoy::Runtime::Loader& runtime,
Event::Dispatcher& dispatcher,
HealthCheckEventLoggerPtr&& event_logger,
ProtobufMessage::ValidationVisitor& validation_visitor,
Api::Api& api)
: cluster_(cluster), runtime_(runtime), dispatcher_(dispatcher),
event_logger_(std::move(event_logger)), validation_visitor_(validation_visitor), api_(api) {
}
| 0
|
793
|
int16_t vp9_dc_quant ( int qindex , int delta ) {
return dc_qlookup [ clamp ( qindex + delta , 0 , MAXQ ) ] ;
}
| 1
|
414,034
|
int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr,
struct wil6210_mbox_hdr *hdr)
{
void __iomem *src = wmi_buffer(wil, ptr);
if (!src)
return -EINVAL;
wil_memcpy_fromio_32(hdr, src, sizeof(*hdr));
return 0;
}
| 0
|
112,386
|
static int hns_nic_dev_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct hns_nic_priv *priv = netdev_priv(ndev);
if (ndev->reg_state != NETREG_UNINITIALIZED)
unregister_netdev(ndev);
if (priv->ring_data)
hns_nic_uninit_ring_data(priv);
priv->ring_data = NULL;
if (ndev->phydev)
phy_disconnect(ndev->phydev);
if (!IS_ERR_OR_NULL(priv->ae_handle))
hnae_put_handle(priv->ae_handle);
priv->ae_handle = NULL;
if (priv->notifier_block.notifier_call)
hnae_unregister_notifier(&priv->notifier_block);
priv->notifier_block.notifier_call = NULL;
set_bit(NIC_STATE_REMOVING, &priv->state);
(void)cancel_work_sync(&priv->service_task);
free_netdev(ndev);
return 0;
}
| 0
|
175,930
|
xsltFreeExtModule(xsltExtModulePtr ext)
{
if (ext == NULL)
return;
xmlFree(ext);
}
| 0
|
144,126
|
sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
sctp_paramhdr_t *param_hdr;
struct sctp_chunk *chunk = arg;
struct sctp_chunk *reply;
size_t paylen = 0;
if (!sctp_vtag_verify(chunk, asoc))
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
/* Make sure that the HEARTBEAT chunk has a valid length. */
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_heartbeat_chunk_t)))
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
commands);
/* 8.3 The receiver of the HEARTBEAT should immediately
* respond with a HEARTBEAT ACK that contains the Heartbeat
* Information field copied from the received HEARTBEAT chunk.
*/
chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr;
paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
if (ntohs(param_hdr->length) > paylen)
return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
param_hdr, commands);
if (!pskb_pull(chunk->skb, paylen))
goto nomem;
reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen);
if (!reply)
goto nomem;
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
return SCTP_DISPOSITION_CONSUME;
nomem:
return SCTP_DISPOSITION_NOMEM;
}
| 0
|
294,354
|
decompress_R2004_section (Bit_Chain *restrict dat, BITCODE_RC *restrict decomp,
uint32_t decomp_data_size, uint32_t comp_data_size)
{
unsigned int i, lit_length;
uint32_t comp_offset, comp_bytes, bytes_left;
unsigned char opcode1 = 0, opcode2;
long unsigned int start_byte = dat->byte;
BITCODE_RC *src, *dst = decomp;
BITCODE_RC *maxdst = decomp + decomp_data_size;
bytes_left = decomp_data_size; // to write to
if (comp_data_size > dat->size - start_byte) // bytes left to read from
{
LOG_WARN ("Invalid comp_data_size %lu > %lu bytes left",
(unsigned long)bytes_left, dat->size - dat->byte)
return DWG_ERR_VALUEOUTOFBOUNDS;
}
// length of the first sequence of uncompressed or literal data.
lit_length = read_literal_length (dat, &opcode1);
if (lit_length > bytes_left)
{
LOG_ERROR ("Invalid literal_length %u > %u bytes left",
lit_length, (unsigned)decomp_data_size)
return DWG_ERR_VALUEOUTOFBOUNDS;
}
bit_read_fixed (dat, decomp, lit_length);
dst += lit_length;
bytes_left -= lit_length;
opcode1 = 0x00;
while (dat->byte - start_byte < comp_data_size)
{
LOG_INSANE ("-O %x ", opcode1)
if (opcode1 == 0x00)
{
opcode1 = bit_read_RC (dat);
LOG_INSANE ("<O %x ", opcode1)
}
if (opcode1 >= 0x40)
{
comp_bytes = ((opcode1 & 0xF0) >> 4) - 1;
opcode2 = bit_read_RC (dat);
LOG_INSANE ("<O %x ", opcode2)
comp_offset = (opcode2 << 2) | ((opcode1 & 0x0C) >> 2);
if (opcode1 & 0x03)
{
lit_length = (opcode1 & 0x03);
opcode1 = 0x00;
}
else
lit_length = read_literal_length (dat, &opcode1);
}
else if (opcode1 >= 0x21
&& opcode1 <= 0x3F) // lgtm [cpp/constant-comparison]
{
comp_bytes = opcode1 - 0x1E;
comp_offset = read_two_byte_offset (dat, &lit_length);
if (lit_length != 0)
opcode1 = 0x00;
else
lit_length = read_literal_length (dat, &opcode1);
}
else if (opcode1 == 0x20)
{
comp_bytes = read_long_compression_offset (dat) + 0x21;
comp_offset = read_two_byte_offset (dat, &lit_length);
if (lit_length != 0)
opcode1 = 0x00;
else
lit_length = read_literal_length (dat, &opcode1);
}
else if (opcode1 >= 0x12 && opcode1 <= 0x1F)
{
comp_bytes = (opcode1 & 0x0F) + 2;
comp_offset = read_two_byte_offset (dat, &lit_length) + 0x3FFF;
if (lit_length != 0)
opcode1 = 0x00;
else
lit_length = read_literal_length (dat, &opcode1);
}
else if (opcode1 == 0x10)
{
comp_bytes = read_long_compression_offset (dat) + 9;
comp_offset = read_two_byte_offset (dat, &lit_length) + 0x3FFF;
if (lit_length != 0)
opcode1 = 0x00;
else
lit_length = read_literal_length (dat, &opcode1);
}
else if (opcode1 == 0x11)
break; // Terminates the input stream, everything is ok
else
{
LOG_ERROR ("Invalid opcode 0x%x in input stream at pos %lu", opcode1,
dat->byte);
return DWG_ERR_INTERNALERROR; // error in input stream
}
src = dst - comp_offset - 1;
if (src < decomp) // was assert (src >= decomp);
{
LOG_ERROR ("decompress_R2004_section: src offset underflow");
return DWG_ERR_INTERNALERROR;
}
if (comp_bytes)
{
LOG_INSANE ("<C %d ", comp_bytes)
// copy "compressed data"
if ((uint32_t)comp_bytes > bytes_left || // bytes left to write
dst + comp_bytes > maxdst)
{
LOG_ERROR ("Invalid comp_bytes %lu > %lu bytes left",
(unsigned long)comp_bytes, (unsigned long)bytes_left)
return DWG_ERR_VALUEOUTOFBOUNDS;
}
for (i = 0; i < comp_bytes; ++i)
*dst++ = *src++;
bytes_left -= comp_bytes;
}
// copy "literal data"
LOG_INSANE ("<L %d\n", lit_length)
if (lit_length)
{
if ((lit_length > bytes_left) // bytes left to write
|| dst + lit_length > maxdst) // dst overflow
{
LOG_ERROR ("Invalid lit_length %u > %lu bytes left",
lit_length, (unsigned long)bytes_left)
return DWG_ERR_VALUEOUTOFBOUNDS;
}
for (i = 0; i < lit_length; ++i)
*dst++ = bit_read_RC (dat);
}
}
return 0; // Success
}
| 0
|
278,009
|
void HWNDMessageHandler::Maximize() {
ExecuteSystemMenuCommand(SC_MAXIMIZE);
}
| 0
|
213,054
|
static Eina_Bool _ewk_frame_contents_set_internal(Ewk_Frame_Smart_Data* smartData, const char* contents, size_t contentsSize, const char* mimeType, const char* encoding, const char* baseUri, const char* unreachableUri)
{
size_t length = strlen(contents);
if (contentsSize < 1 || contentsSize > length)
contentsSize = length;
if (!mimeType)
mimeType = "text/html";
if (!encoding)
encoding = "UTF-8";
if (!baseUri)
baseUri = "about:blank";
WebCore::KURL baseKURL(WebCore::KURL(), WTF::String::fromUTF8(baseUri));
WebCore::KURL unreachableKURL;
if (unreachableUri)
unreachableKURL = WebCore::KURL(WebCore::KURL(), WTF::String::fromUTF8(unreachableUri));
else
unreachableKURL = WebCore::KURL();
WTF::RefPtr<WebCore::SharedBuffer> buffer = WebCore::SharedBuffer::create(contents, contentsSize);
WebCore::SubstituteData substituteData
(buffer.release(),
WTF::String::fromUTF8(mimeType),
WTF::String::fromUTF8(encoding),
baseKURL, unreachableKURL);
WebCore::ResourceRequest request(baseKURL);
smartData->frame->loader()->load(request, substituteData, false);
return true;
}
| 0
|
365,058
|
tor_tls_context_incref(tor_tls_context_t *ctx)
{
++ctx->refcnt;
}
| 0
|
189,919
|
bool SendPacket(QuicPacketSequenceNumber sequence_number,
QuicPacket* packet,
bool resend,
bool force) {
return QuicConnection::SendPacket(sequence_number, packet, resend, force);
}
| 0
|
330,501
|
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors, BdrvRequestFlags flags)
{
BlockDriver *drv = bs->drv;
QEMUIOVector qiov;
struct iovec iov = {0};
int ret = 0;
int max_write_zeroes = bs->bl.max_write_zeroes ?
bs->bl.max_write_zeroes : MAX_WRITE_ZEROES_DEFAULT;
while (nb_sectors > 0 && !ret) {
int num = nb_sectors;
/* Align request. Block drivers can expect the "bulk" of the request
* to be aligned.
*/
if (bs->bl.write_zeroes_alignment
&& num > bs->bl.write_zeroes_alignment) {
if (sector_num % bs->bl.write_zeroes_alignment != 0) {
/* Make a small request up to the first aligned sector. */
num = bs->bl.write_zeroes_alignment;
num -= sector_num % bs->bl.write_zeroes_alignment;
} else if ((sector_num + num) % bs->bl.write_zeroes_alignment != 0) {
/* Shorten the request to the last aligned sector. num cannot
* underflow because num > bs->bl.write_zeroes_alignment.
*/
num -= (sector_num + num) % bs->bl.write_zeroes_alignment;
}
}
/* limit request size */
if (num > max_write_zeroes) {
num = max_write_zeroes;
}
ret = -ENOTSUP;
/* First try the efficient write zeroes operation */
if (drv->bdrv_co_write_zeroes) {
ret = drv->bdrv_co_write_zeroes(bs, sector_num, num, flags);
}
if (ret == -ENOTSUP) {
/* Fall back to bounce buffer if write zeroes is unsupported */
iov.iov_len = num * BDRV_SECTOR_SIZE;
if (iov.iov_base == NULL) {
iov.iov_base = qemu_blockalign(bs, num * BDRV_SECTOR_SIZE);
memset(iov.iov_base, 0, num * BDRV_SECTOR_SIZE);
}
qemu_iovec_init_external(&qiov, &iov, 1);
ret = drv->bdrv_co_writev(bs, sector_num, num, &qiov);
/* Keep bounce buffer around if it is big enough for all
* all future requests.
*/
if (num < max_write_zeroes) {
qemu_vfree(iov.iov_base);
iov.iov_base = NULL;
}
}
sector_num += num;
nb_sectors -= num;
}
qemu_vfree(iov.iov_base);
return ret;
}
| 1
|
481,305
|
create_macro(const char *name, const widechar *definition, int definition_length,
const int *substitutions, int substitution_count, int argument_count) {
Macro *m = malloc(sizeof(Macro));
m->name = strdup(name);
widechar *definition_copy = malloc(definition_length * sizeof(widechar));
memcpy(definition_copy, definition, definition_length * sizeof(widechar));
m->definition = definition_copy;
m->definition_length = definition_length;
int *substitutions_copy = malloc(2 * substitution_count * sizeof(int));
memcpy(substitutions_copy, substitutions, 2 * substitution_count * sizeof(int));
m->substitutions = substitutions_copy;
m->substitution_count = substitution_count;
m->argument_count = argument_count;
return m;
}
| 0
|
502,448
|
struct winsdb_addr **winsdb_addr_list_add(struct winsdb_handle *h, const struct winsdb_record *rec,
struct winsdb_addr **addresses, const char *address,
const char *wins_owner, time_t expire_time,
bool is_name_registration)
{
struct winsdb_addr *old_addr = NULL;
size_t len = 0;
size_t i;
bool found_old_replica = false;
/*
* count the addresses and maybe
* find an old entry for the new address
*/
for (i=0; addresses[i]; i++) {
if (old_addr) continue;
if (strcmp(addresses[i]->address, address) == 0) {
old_addr = addresses[i];
}
}
len = i;
/*
* the address is already there
* and we can replace it
*/
if (old_addr) {
goto remove_old_addr;
}
/*
* if we don't have 25 addresses already,
* we can just add the new address
*/
if (len < 25) {
goto add_new_addr;
}
/*
* if we haven't found the address,
* and we have already have 25 addresses
* if so then we need to do the following:
* - if it isn't a name registration, then just ignore the new address
* - if it is a name registration, then first search for
* the oldest replica and if there's no replica address
* search the oldest owned address
*/
if (!is_name_registration) {
return addresses;
}
/*
* find the oldest replica address, if there's no replica
* record at all, find the oldest owned address
*/
for (i=0; addresses[i]; i++) {
bool cur_is_replica = false;
/* find out if the current address is a replica */
if (strcmp(addresses[i]->wins_owner, h->local_owner) != 0) {
cur_is_replica = true;
}
/*
* if we already found a replica address and the current address
* is not a replica, then skip it
*/
if (found_old_replica && !cur_is_replica) continue;
/*
* if we found the first replica address, reset the address
* that would be replaced
*/
if (!found_old_replica && cur_is_replica) {
found_old_replica = true;
old_addr = addresses[i];
continue;
}
/*
* if the first address isn't a replica, just start with
* the first one
*/
if (!old_addr) {
old_addr = addresses[i];
continue;
}
/*
* see if we find an older address
*/
if (addresses[i]->expire_time < old_addr->expire_time) {
old_addr = addresses[i];
continue;
}
}
remove_old_addr:
winsdb_addr_list_remove(addresses, old_addr->address);
len --;
add_new_addr:
addresses = talloc_realloc(addresses, addresses, struct winsdb_addr *, len + 2);
if (!addresses) return NULL;
addresses[len] = talloc(addresses, struct winsdb_addr);
if (!addresses[len]) {
talloc_free(addresses);
return NULL;
}
addresses[len]->address = talloc_strdup(addresses[len], address);
if (!addresses[len]->address) {
talloc_free(addresses);
return NULL;
}
addresses[len]->wins_owner = talloc_strdup(addresses[len], wins_owner);
if (!addresses[len]->wins_owner) {
talloc_free(addresses);
return NULL;
}
addresses[len]->expire_time = expire_time;
addresses[len+1] = NULL;
LDB_TYPESAFE_QSORT(addresses, len+1, h, winsdb_addr_sort_list);
return addresses;
}
| 0
|
435,453
|
static int xml_add_ns(xmlNodePtr req, xmlNsPtr *respNs, xmlNodePtr root)
{
for (; req; req = req->next) {
if (req->type == XML_ELEMENT_NODE) {
xmlNsPtr nsDef;
for (nsDef = req->nsDef; nsDef; nsDef = nsDef->next) {
if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_DAV))
ensure_ns(respNs, NS_DAV, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_CALDAV))
ensure_ns(respNs, NS_CALDAV, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_CARDDAV))
ensure_ns(respNs, NS_CARDDAV, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_CS))
ensure_ns(respNs, NS_CS, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_MECOM))
ensure_ns(respNs, NS_MECOM, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_MOBME))
ensure_ns(respNs, NS_MOBME, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else if (!xmlStrcmp(nsDef->href, BAD_CAST XML_NS_CYRUS))
ensure_ns(respNs, NS_CYRUS, root,
(const char *) nsDef->href,
(const char *) nsDef->prefix);
else
xmlNewNs(root, nsDef->href, nsDef->prefix);
}
}
xml_add_ns(req->children, respNs, root);
}
/* XXX check for errors */
return 0;
}
| 0
|
290,325
|
int main ( int argc , char * * argv ) {
int option_idx = 0 ;
int result ;
const char * adb_server_ip = NULL ;
unsigned short * adb_server_tcp_port = NULL ;
unsigned int logcat_text = 0 ;
const char * default_adb_server_ip = "127.0.0.1" ;
unsigned short default_adb_server_tcp_port = 5037 ;
unsigned short local_adb_server_tcp_port ;
unsigned short local_bt_server_tcp_port ;
unsigned short local_bt_local_tcp_port ;
unsigned short * bt_server_tcp_port = NULL ;
unsigned int bt_forward_socket = 0 ;
const char * bt_local_ip = NULL ;
unsigned short * bt_local_tcp_port = NULL ;
unsigned short default_bt_server_tcp_port = 4330 ;
const char * default_bt_local_ip = "127.0.0.1" ;
unsigned short default_bt_local_tcp_port = 4330 ;
extcap_parameters * extcap_conf = NULL ;
# ifdef _WIN32 WSADATA wsaData ;
attach_parent_console ( ) ;
# endif opterr = 0 ;
optind = 0 ;
if ( argc == 1 ) {
help ( ) ;
return EXIT_CODE_SUCCESS ;
}
extcap_conf = g_new0 ( extcap_parameters , 1 ) ;
extcap_base_set_util_info ( extcap_conf , ANDROIDDUMP_VERSION_MAJOR , ANDROIDDUMP_VERSION_MINOR , ANDROIDDUMP_VERSION_RELEASE , NULL ) ;
while ( ( result = getopt_long ( argc , argv , "" , longopts , & option_idx ) ) != - 1 ) {
switch ( result ) {
case OPT_VERSION : printf ( "%s.%s.%s\n" , ANDROIDDUMP_VERSION_MAJOR , ANDROIDDUMP_VERSION_MINOR , ANDROIDDUMP_VERSION_RELEASE ) ;
return EXIT_CODE_SUCCESS ;
case OPT_VERBOSE : if ( optarg ) verbose = ( g_ascii_strncasecmp ( optarg , "TRUE" , 4 ) == 0 ) ;
else verbose = 1 ;
{
int j = 0 ;
verbose_print ( "VERBOSE: Command line: " ) ;
while ( j < argc ) {
verbose_print ( "%s " , argv [ j ] ) ;
j += 1 ;
}
verbose_print ( "\n" ) ;
}
break ;
case OPT_HELP : help ( ) ;
return EXIT_CODE_SUCCESS ;
case OPT_CONFIG_ADB_SERVER_IP : adb_server_ip = optarg ;
break ;
case OPT_CONFIG_ADB_SERVER_TCP_PORT : adb_server_tcp_port = & local_adb_server_tcp_port ;
if ( ! optarg ) {
errmsg_print ( "ERROR: Impossible exception. Parameter required argument, but there is no it right now." ) ;
return EXIT_CODE_GENERIC ;
}
* adb_server_tcp_port = ( unsigned short ) g_ascii_strtoull ( optarg , NULL , 10 ) ;
break ;
case OPT_CONFIG_LOGCAT_TEXT : logcat_text = ( g_ascii_strncasecmp ( optarg , "TRUE" , 4 ) == 0 ) ;
break ;
case OPT_CONFIG_BT_SERVER_TCP_PORT : bt_server_tcp_port = & local_bt_server_tcp_port ;
if ( ! optarg ) {
errmsg_print ( "ERROR: Impossible exception. Parameter required argument, but there is no it right now." ) ;
return EXIT_CODE_GENERIC ;
}
* bt_server_tcp_port = ( unsigned short ) g_ascii_strtoull ( optarg , NULL , 10 ) ;
break ;
case OPT_CONFIG_BT_FORWARD_SOCKET : bt_forward_socket = ( g_ascii_strncasecmp ( optarg , "TRUE" , 4 ) == 0 ) ;
break ;
case OPT_CONFIG_BT_LOCAL_IP : bt_local_ip = optarg ;
break ;
case OPT_CONFIG_BT_LOCAL_TCP_PORT : bt_local_tcp_port = & local_bt_local_tcp_port ;
if ( ! optarg ) {
errmsg_print ( "ERROR: Impossible exception. Parameter required argument, but there is no it right now." ) ;
return EXIT_CODE_GENERIC ;
}
* bt_local_tcp_port = ( unsigned short ) g_ascii_strtoull ( optarg , NULL , 10 ) ;
break ;
default : if ( ! extcap_base_parse_options ( extcap_conf , result - EXTCAP_OPT_LIST_INTERFACES , optarg ) ) {
printf ( "Invalid argument <%s>. Try --help.\n" , argv [ optind - 1 ] ) ;
return EXIT_CODE_GENERIC ;
}
}
}
if ( ! adb_server_ip ) adb_server_ip = default_adb_server_ip ;
if ( ! adb_server_tcp_port ) adb_server_tcp_port = & default_adb_server_tcp_port ;
if ( ! bt_server_tcp_port ) bt_server_tcp_port = & default_bt_server_tcp_port ;
if ( ! bt_local_ip ) bt_local_ip = default_bt_local_ip ;
if ( ! bt_local_tcp_port ) bt_local_tcp_port = & default_bt_local_tcp_port ;
# ifdef _WIN32 result = WSAStartup ( MAKEWORD ( 1 , 1 ) , & wsaData ) ;
if ( result != 0 ) {
errmsg_print ( "ERROR: WSAStartup failed with error: %d" , result ) ;
return EXIT_CODE_GENERIC ;
}
# endif if ( extcap_conf -> do_list_interfaces ) register_interfaces ( extcap_conf , adb_server_ip , adb_server_tcp_port ) ;
if ( extcap_base_handle_interface ( extcap_conf ) ) return EXIT_CODE_SUCCESS ;
if ( extcap_conf -> show_config ) return list_config ( extcap_conf -> interface ) ;
if ( extcap_conf -> capture ) {
if ( extcap_conf -> interface && ( is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_MAIN ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_RADIO ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) ) ) if ( logcat_text ) return capture_android_logcat_text ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else return capture_android_logcat ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else if ( extcap_conf -> interface && ( is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_TEXT_MAIN ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_TEXT_SYSTEM ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_TEXT_RADIO ) || is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_TEXT_EVENTS ) || ( is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_LOGCAT_TEXT_CRASH ) ) ) ) return capture_android_logcat_text ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else if ( extcap_conf -> interface && is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_BLUETOOTH_HCIDUMP ) ) return capture_android_bluetooth_hcidump ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else if ( extcap_conf -> interface && is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_BLUETOOTH_EXTERNAL_PARSER ) ) return capture_android_bluetooth_external_parser ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port , bt_server_tcp_port , bt_forward_socket , bt_local_ip , bt_local_tcp_port ) ;
else if ( extcap_conf -> interface && ( is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_BLUETOOTH_BTSNOOP_NET ) ) ) return capture_android_bluetooth_btsnoop_net ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else if ( extcap_conf -> interface && ( is_specified_interface ( extcap_conf -> interface , INTERFACE_ANDROID_WIFI_TCPDUMP ) ) ) return capture_android_wifi_tcpdump ( extcap_conf -> interface , extcap_conf -> fifo , adb_server_ip , adb_server_tcp_port ) ;
else return EXIT_CODE_GENERIC ;
}
extcap_base_cleanup ( & extcap_conf ) ;
return EXIT_CODE_SUCCESS ;
}
| 0
|
125,740
|
Variant HHVM_FUNCTION(exif_thumbnail, const String& filename,
VRefParam width /* = null */,
VRefParam height /* = null */,
VRefParam imagetype /* = null */) {
image_info_type ImageInfo;
memset(&ImageInfo, 0, sizeof(ImageInfo));
int ret = exif_read_file(&ImageInfo, filename.c_str(), 1, 0);
if (ret==0) {
exif_discard_imageinfo(&ImageInfo);
return false;
}
if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) {
exif_discard_imageinfo(&ImageInfo);
return false;
}
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo);
}
width.assignIfRef((int64_t)ImageInfo.Thumbnail.width);
height.assignIfRef((int64_t)ImageInfo.Thumbnail.height);
imagetype.assignIfRef(ImageInfo.Thumbnail.filetype);
String str(ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, CopyString);
exif_discard_imageinfo(&ImageInfo);
return str;
}
| 0
|
253,781
|
void AwContents::RequestNewHitTestDataAt(JNIEnv* env,
jobject obj,
jfloat x,
jfloat y,
jfloat touch_major) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
gfx::PointF touch_center(x, y);
gfx::SizeF touch_area(touch_major, touch_major);
render_view_host_ext_->RequestNewHitTestDataAt(touch_center, touch_area);
}
| 0
|
370,760
|
rb_str_buf_cat(VALUE str, const char *ptr, long len)
{
if (len == 0) return str;
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
return str_buf_cat(str, ptr, len);
}
| 0
|
321,129
|
target_ulong cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
{
uint8_t *pde_ptr, *pte_ptr;
uint32_t pde, pte, paddr, page_offset, page_size;
if (!(env->cr[0] & CR0_PG_MASK)) {
pte = addr;
page_size = 4096;
} else {
/* page directory entry */
pde_ptr = phys_ram_base +
(((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & a20_mask);
pde = ldl_raw(pde_ptr);
if (!(pde & PG_PRESENT_MASK))
return -1;
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
pte = pde & ~0x003ff000; /* align to 4MB */
page_size = 4096 * 1024;
} else {
/* page directory entry */
pte_ptr = phys_ram_base +
(((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & a20_mask);
pte = ldl_raw(pte_ptr);
if (!(pte & PG_PRESENT_MASK))
return -1;
page_size = 4096;
}
}
pte = pte & a20_mask;
page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
paddr = (pte & TARGET_PAGE_MASK) + page_offset;
return paddr;
}
| 0
|
274,278
|
static int ntlm_write_ntlm_v2_client_challenge(wStream* s, NTLMv2_CLIENT_CHALLENGE* challenge)
{
ULONG length;
Stream_Write_UINT8(s, challenge->RespType);
Stream_Write_UINT8(s, challenge->HiRespType);
Stream_Write_UINT16(s, challenge->Reserved1);
Stream_Write_UINT32(s, challenge->Reserved2);
Stream_Write(s, challenge->Timestamp, 8);
Stream_Write(s, challenge->ClientChallenge, 8);
Stream_Write_UINT32(s, challenge->Reserved3);
length = ntlm_av_pair_list_length(challenge->AvPairs, challenge->cbAvPairs);
Stream_Write(s, challenge->AvPairs, length);
return 1;
}
| 0
|
200,976
|
void WebContentsImpl::DidFailProvisionalLoadWithError(
RenderViewHost* render_view_host,
const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
<< ", error_code: " << params.error_code
<< ", error_description: " << params.error_description
<< ", is_main_frame: " << params.is_main_frame
<< ", showing_repost_interstitial: " <<
params.showing_repost_interstitial
<< ", frame_id: " << params.frame_id;
GURL validated_url(params.url);
RenderProcessHost* render_process_host =
render_view_host->GetProcess();
RenderViewHost::FilterURL(render_process_host, false, &validated_url);
if (net::ERR_ABORTED == params.error_code) {
if (ShowingInterstitialPage()) {
LOG(WARNING) << "Discarding message during interstitial.";
return;
}
render_manager_.RendererAbortedProvisionalLoad(render_view_host);
}
if (controller_.GetPendingEntry() != controller_.GetVisibleEntry())
controller_.DiscardPendingEntry();
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
DidFailProvisionalLoad(params.frame_id,
params.is_main_frame,
validated_url,
params.error_code,
params.error_description,
render_view_host));
}
| 0
|
439,734
|
SplashGouraudPattern::~SplashGouraudPattern() {
}
| 0
|
428,605
|
replace_async_data_free (ReplaceAsyncData *data)
{
if (data->stream)
g_object_unref (data->stream);
g_free (data->etag);
g_free (data);
}
| 0
|
190,916
|
bool HTMLCanvasElement::WouldTaintOrigin() const {
return !OriginClean();
}
| 0
|
243,463
|
void LayerTreeHost::RegisterViewportLayers(
scoped_refptr<Layer> page_scale_layer,
scoped_refptr<Layer> inner_viewport_scroll_layer,
scoped_refptr<Layer> outer_viewport_scroll_layer) {
page_scale_layer_ = page_scale_layer;
inner_viewport_scroll_layer_ = inner_viewport_scroll_layer;
outer_viewport_scroll_layer_ = outer_viewport_scroll_layer;
}
| 0
|
399,988
|
policy_hash(const policy_map_ent_t *ent)
{
const addr_policy_t *a = ent->policy;
addr_policy_t aa;
memset(&aa, 0, sizeof(aa));
aa.prt_min = a->prt_min;
aa.prt_max = a->prt_max;
aa.maskbits = a->maskbits;
aa.policy_type = a->policy_type;
aa.is_private = a->is_private;
if (a->is_private) {
aa.is_private = 1;
} else {
tor_addr_copy_tight(&aa.addr, &a->addr);
}
return (unsigned) siphash24g(&aa, sizeof(aa));
}
| 0
|
382,560
|
my_regcomp(preg, pattern, cflags, charset)
my_regex_t *preg;
const char *pattern;
int cflags;
CHARSET_INFO *charset;
{
struct parse pa;
register struct re_guts *g;
register struct parse *p = &pa;
register int i;
register size_t len;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
#else
# define GOODFLAGS(f) ((f)&~REG_DUMP)
#endif
my_regex_init(charset, NULL); /* Init cclass if neaded */
preg->charset=charset;
cflags = GOODFLAGS(cflags);
if ((cflags®_EXTENDED) && (cflags®_NOSPEC))
return(REG_INVARG);
if (cflags®_PEND) {
if (preg->re_endp < pattern)
return(REG_INVARG);
len = preg->re_endp - pattern;
} else
len = strlen((char *)pattern);
/*
Find the maximum len we can safely process
without a rollover and a mis-malloc.
p->ssize is a sopno is a long (32+ bit signed);
size_t is 16+ bit unsigned.
*/
{
size_t new_ssize = len / (size_t)2 * (size_t)3 + (size_t)1; /* ugh */
if ((new_ssize < len) || /* size_t rolled over */
((SIZE_T_MAX / sizeof(sop)) < new_ssize) || /* malloc arg */
(new_ssize > LONG_MAX)) /* won't fit in ssize */
return(REG_ESPACE); /* MY_REG_ESPACE or MY_REG_INVARG */
p->ssize = new_ssize;
}
/* do the mallocs early so failure handling is easy */
g = (struct re_guts *)malloc(sizeof(struct re_guts) +
(NC-1)*sizeof(cat_t));
if (g == NULL)
return(REG_ESPACE);
p->strip = (sop *)malloc(p->ssize * sizeof(sop));
p->slen = 0;
if (p->strip == NULL) {
free((char *)g);
return(REG_ESPACE);
}
/* set things up */
p->g = g;
p->next = (char *)pattern; /* convenience; we do not modify it */
p->end = p->next + len;
p->error = 0;
p->ncsalloc = 0;
p->charset = preg->charset;
for (i = 0; i < NPAREN; i++) {
p->pbegin[i] = 0;
p->pend[i] = 0;
}
g->csetsize = NC;
g->sets = NULL;
g->setbits = NULL;
g->ncsets = 0;
g->cflags = cflags;
g->iflags = 0;
g->nbol = 0;
g->neol = 0;
g->must = NULL;
g->mlen = 0;
g->nsub = 0;
g->ncategories = 1; /* category 0 is "everything else" */
g->categories = &g->catspace[-(CHAR_MIN)];
(void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
g->backrefs = 0;
/* do it */
EMIT(OEND, 0);
g->firststate = THERE();
if (cflags®_EXTENDED)
p_ere(p, OUT);
else if (cflags®_NOSPEC)
p_str(p);
else
p_bre(p, OUT, OUT);
EMIT(OEND, 0);
g->laststate = THERE();
/* tidy up loose ends and fill things in */
categorize(p, g);
stripsnug(p, g);
findmust(p, g);
g->nplus = pluscount(p, g);
g->magic = MAGIC2;
preg->re_nsub = g->nsub;
preg->re_g = g;
preg->re_magic = MAGIC1;
#ifndef REDEBUG
/* not debugging, so can't rely on the assert() in regexec() */
if (g->iflags&BAD)
SETERROR(REG_ASSERT);
#endif
/* win or lose, we're done */
if (p->error != 0) /* lose */
my_regfree(preg);
return(p->error);
}
| 0
|
32,876
|
void teecore_init_pub_ram(void)
{
vaddr_t s;
vaddr_t e;
/* get virtual addr/size of NSec shared mem allcated from teecore */
core_mmu_get_mem_by_type(MEM_AREA_NSEC_SHM, &s, &e);
if (s >= e || s & SMALL_PAGE_MASK || e & SMALL_PAGE_MASK)
panic("invalid PUB RAM");
/* extra check: we could rely on core_mmu_get_mem_by_type() */
if (!tee_vbuf_is_non_sec(s, e - s))
panic("PUB RAM is not non-secure");
#ifdef CFG_PL310
/* Allocate statically the l2cc mutex */
tee_l2cc_store_mutex_boot_pa(virt_to_phys((void *)s));
s += sizeof(uint32_t); /* size of a pl310 mutex */
s = ROUNDUP(s, SMALL_PAGE_SIZE); /* keep required alignment */
#endif
default_nsec_shm_paddr = virt_to_phys((void *)s);
default_nsec_shm_size = e - s;
}
| 0
|
429,118
|
static MagickBooleanType WriteICONImage(const ImageInfo *image_info,
Image *image)
{
const char
*option;
IconFile
icon_file;
IconInfo
icon_info;
Image
*images,
*next;
MagickBooleanType
status;
MagickOffsetType
offset,
scene;
register const IndexPacket
*indexes;
register const PixelPacket
*p;
register ssize_t
i,
x;
register unsigned char
*q;
size_t
bytes_per_line,
imageListLength,
scanline_pad;
ssize_t
y;
unsigned char
bit,
byte,
*pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
images=(Image *) NULL;
option=GetImageOption(image_info,"icon:auto-resize");
if (option != (const char *) NULL)
{
images=AutoResizeImage(image,option,&scene,&image->exception);
if (images == (Image *) NULL)
ThrowWriterException(ImageError,"InvalidDimensions");
}
else
{
scene=0;
next=image;
do
{
if ((image->columns > 256L) || (image->rows > 256L))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
scene++;
next=SyncNextImageInList(next);
} while ((next != (Image *) NULL) && (image_info->adjoin !=
MagickFalse));
}
/*
Dump out a ICON header template to be properly initialized later.
*/
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,1);
(void) WriteBlobLSBShort(image,(unsigned char) scene);
(void) memset(&icon_file,0,sizeof(icon_file));
(void) memset(&icon_info,0,sizeof(icon_info));
scene=0;
next=(images != (Image *) NULL) ? images : image;
do
{
(void) WriteBlobByte(image,icon_file.directory[scene].width);
(void) WriteBlobByte(image,icon_file.directory[scene].height);
(void) WriteBlobByte(image,icon_file.directory[scene].colors);
(void) WriteBlobByte(image,icon_file.directory[scene].reserved);
(void) WriteBlobLSBShort(image,icon_file.directory[scene].planes);
(void) WriteBlobLSBShort(image,icon_file.directory[scene].bits_per_pixel);
(void) WriteBlobLSBLong(image,(unsigned int)
icon_file.directory[scene].size);
(void) WriteBlobLSBLong(image,(unsigned int)
icon_file.directory[scene].offset);
scene++;
next=SyncNextImageInList(next);
} while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
scene=0;
next=(images != (Image *) NULL) ? images : image;
imageListLength=GetImageListLength(image);
do
{
if ((next->columns > 255L) && (next->rows > 255L) &&
((next->compression == UndefinedCompression) ||
(next->compression == ZipCompression)))
{
Image
*write_image;
ImageInfo
*write_info;
size_t
length;
unsigned char
*png;
write_image=CloneImage(next,0,0,MagickTrue,&image->exception);
if (write_image == (Image *) NULL)
{
images=DestroyImageList(images);
return(MagickFalse);
}
write_info=CloneImageInfo(image_info);
(void) CopyMagickString(write_info->magick,"PNG",MagickPathExtent);
length=0;
/* Don't write any ancillary chunks except for gAMA */
(void) SetImageArtifact(write_image,"png:include-chunk","none,gama");
/* Only write PNG32 formatted PNG (32-bit RGBA), 8 bits per channel */
(void) SetImageArtifact(write_image,"png:format","png32");
png=(unsigned char *) ImageToBlob(write_info,write_image,&length,
&image->exception);
write_image=DestroyImageList(write_image);
write_info=DestroyImageInfo(write_info);
if (png == (unsigned char *) NULL)
{
images=DestroyImageList(images);
return(MagickFalse);
}
icon_file.directory[scene].width=0;
icon_file.directory[scene].height=0;
icon_file.directory[scene].colors=0;
icon_file.directory[scene].reserved=0;
icon_file.directory[scene].planes=1;
icon_file.directory[scene].bits_per_pixel=32;
icon_file.directory[scene].size=(size_t) length;
icon_file.directory[scene].offset=(size_t) TellBlob(image);
(void) WriteBlob(image,(size_t) length,png);
png=(unsigned char *) RelinquishMagickMemory(png);
}
else
{
/*
Initialize ICON raster file header.
*/
(void) TransformImageColorspace(image,sRGBColorspace);
icon_info.file_size=14+12+28;
icon_info.offset_bits=icon_info.file_size;
icon_info.compression=BI_RGB;
if ((next->storage_class != DirectClass) && (next->colors > 256))
(void) SetImageStorageClass(next,DirectClass);
if (next->storage_class == DirectClass)
{
/*
Full color ICON raster.
*/
icon_info.number_colors=0;
icon_info.bits_per_pixel=32;
icon_info.compression=(size_t) BI_RGB;
}
else
{
size_t
one;
/*
Colormapped ICON raster.
*/
icon_info.bits_per_pixel=8;
if (next->colors <= 256)
icon_info.bits_per_pixel=8;
if (next->colors <= 16)
icon_info.bits_per_pixel=4;
if (next->colors <= 2)
icon_info.bits_per_pixel=1;
one=1;
icon_info.number_colors=one << icon_info.bits_per_pixel;
if (icon_info.number_colors < next->colors)
{
(void) SetImageStorageClass(next,DirectClass);
icon_info.number_colors=0;
icon_info.bits_per_pixel=(unsigned short) 24;
icon_info.compression=(size_t) BI_RGB;
}
else
{
size_t
one;
one=1;
icon_info.file_size+=3*(one << icon_info.bits_per_pixel);
icon_info.offset_bits+=3*(one << icon_info.bits_per_pixel);
icon_info.file_size+=(one << icon_info.bits_per_pixel);
icon_info.offset_bits+=(one << icon_info.bits_per_pixel);
}
}
bytes_per_line=(((next->columns*icon_info.bits_per_pixel)+31) &
~31) >> 3;
icon_info.ba_offset=0;
icon_info.width=(ssize_t) next->columns;
icon_info.height=(ssize_t) next->rows;
icon_info.planes=1;
icon_info.image_size=bytes_per_line*next->rows;
icon_info.size=40;
icon_info.size+=(4*icon_info.number_colors);
icon_info.size+=icon_info.image_size;
icon_info.size+=(((icon_info.width+31) & ~31) >> 3)*icon_info.height;
icon_info.file_size+=icon_info.image_size;
icon_info.x_pixels=0;
icon_info.y_pixels=0;
switch (next->units)
{
case UndefinedResolution:
case PixelsPerInchResolution:
{
icon_info.x_pixels=(size_t) (100.0*next->x_resolution/2.54);
icon_info.y_pixels=(size_t) (100.0*next->y_resolution/2.54);
break;
}
case PixelsPerCentimeterResolution:
{
icon_info.x_pixels=(size_t) (100.0*next->x_resolution);
icon_info.y_pixels=(size_t) (100.0*next->y_resolution);
break;
}
}
icon_info.colors_important=icon_info.number_colors;
/*
Convert MIFF to ICON raster pixels.
*/
pixels=(unsigned char *) AcquireQuantumMemory((size_t)
icon_info.image_size,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
{
images=DestroyImageList(images);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) memset(pixels,0,(size_t) icon_info.image_size);
switch (icon_info.bits_per_pixel)
{
case 1:
{
size_t
bit,
byte;
/*
Convert PseudoClass image to a ICON monochrome image.
*/
for (y=0; y < (ssize_t) next->rows; y++)
{
p=GetVirtualPixels(next,0,y,next->columns,1,&next->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(next);
q=pixels+(next->rows-y-1)*bytes_per_line;
bit=0;
byte=0;
for (x=0; x < (ssize_t) next->columns; x++)
{
byte<<=1;
byte|=GetPixelIndex(indexes+x) != 0 ? 0x01 : 0x00;
bit++;
if (bit == 8)
{
*q++=(unsigned char) byte;
bit=0;
byte=0;
}
}
if (bit != 0)
*q++=(unsigned char) (byte << (8-bit));
if (next->previous == (Image *) NULL)
{
status=SetImageProgress(next,SaveImageTag,y,next->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case 4:
{
size_t
nibble,
byte;
/*
Convert PseudoClass image to a ICON monochrome image.
*/
for (y=0; y < (ssize_t) next->rows; y++)
{
p=GetVirtualPixels(next,0,y,next->columns,1,&next->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(next);
q=pixels+(next->rows-y-1)*bytes_per_line;
nibble=0;
byte=0;
for (x=0; x < (ssize_t) next->columns; x++)
{
byte<<=4;
byte|=((size_t) GetPixelIndex(indexes+x) & 0x0f);
nibble++;
if (nibble == 2)
{
*q++=(unsigned char) byte;
nibble=0;
byte=0;
}
}
if (nibble != 0)
*q++=(unsigned char) (byte << 4);
if (next->previous == (Image *) NULL)
{
status=SetImageProgress(next,SaveImageTag,y,next->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case 8:
{
/*
Convert PseudoClass packet to ICON pixel.
*/
for (y=0; y < (ssize_t) next->rows; y++)
{
p=GetVirtualPixels(next,0,y,next->columns,1,&next->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(next);
q=pixels+(next->rows-y-1)*bytes_per_line;
for (x=0; x < (ssize_t) next->columns; x++)
*q++=(unsigned char) GetPixelIndex(indexes+x);
if (next->previous == (Image *) NULL)
{
status=SetImageProgress(next,SaveImageTag,y,next->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case 24:
case 32:
{
/*
Convert DirectClass packet to ICON BGR888 or BGRA8888 pixel.
*/
for (y=0; y < (ssize_t) next->rows; y++)
{
p=GetVirtualPixels(next,0,y,next->columns,1,&next->exception);
if (p == (const PixelPacket *) NULL)
break;
q=pixels+(next->rows-y-1)*bytes_per_line;
for (x=0; x < (ssize_t) next->columns; x++)
{
*q++=ScaleQuantumToChar(GetPixelBlue(p));
*q++=ScaleQuantumToChar(GetPixelGreen(p));
*q++=ScaleQuantumToChar(GetPixelRed(p));
if (next->matte == MagickFalse)
*q++=ScaleQuantumToChar(QuantumRange);
else
*q++=ScaleQuantumToChar(GetPixelAlpha(p));
p++;
}
if (icon_info.bits_per_pixel == 24)
for (x=3L*(ssize_t) next->columns; x < (ssize_t) bytes_per_line; x++)
*q++=0x00;
if (next->previous == (Image *) NULL)
{
status=SetImageProgress(next,SaveImageTag,y,next->rows);
if (status == MagickFalse)
break;
}
}
break;
}
}
/*
Write 40-byte version 3+ bitmap header.
*/
icon_file.directory[scene].width=(unsigned char) icon_info.width;
icon_file.directory[scene].height=(unsigned char) icon_info.height;
icon_file.directory[scene].colors=(unsigned char)
icon_info.number_colors;
icon_file.directory[scene].reserved=0;
icon_file.directory[scene].planes=icon_info.planes;
icon_file.directory[scene].bits_per_pixel=icon_info.bits_per_pixel;
icon_file.directory[scene].size=icon_info.size;
icon_file.directory[scene].offset=(size_t) TellBlob(image);
(void) WriteBlobLSBLong(image,(unsigned int) 40);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.width);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.height*2);
(void) WriteBlobLSBShort(image,icon_info.planes);
(void) WriteBlobLSBShort(image,icon_info.bits_per_pixel);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.compression);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.image_size);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.x_pixels);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.y_pixels);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.number_colors);
(void) WriteBlobLSBLong(image,(unsigned int) icon_info.colors_important);
if (next->storage_class == PseudoClass)
{
unsigned char
*icon_colormap;
/*
Dump colormap to file.
*/
icon_colormap=(unsigned char *) AcquireQuantumMemory((size_t)
(1UL << icon_info.bits_per_pixel),4UL*sizeof(*icon_colormap));
if (icon_colormap == (unsigned char *) NULL)
{
images=DestroyImageList(images);
ThrowWriterException(ResourceLimitError,
"MemoryAllocationFailed");
}
q=icon_colormap;
for (i=0; i < (ssize_t) next->colors; i++)
{
*q++=ScaleQuantumToChar(next->colormap[i].blue);
*q++=ScaleQuantumToChar(next->colormap[i].green);
*q++=ScaleQuantumToChar(next->colormap[i].red);
*q++=(unsigned char) 0x0;
}
for ( ; i < (ssize_t) (1UL << icon_info.bits_per_pixel); i++)
{
*q++=(unsigned char) 0x00;
*q++=(unsigned char) 0x00;
*q++=(unsigned char) 0x00;
*q++=(unsigned char) 0x00;
}
(void) WriteBlob(image,(size_t) (4UL*(1UL <<
icon_info.bits_per_pixel)),icon_colormap);
icon_colormap=(unsigned char *) RelinquishMagickMemory(
icon_colormap);
}
(void) WriteBlob(image,(size_t) icon_info.image_size,pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
/*
Write matte mask.
*/
scanline_pad=(((next->columns+31) & ~31)-next->columns) >> 3;
for (y=((ssize_t) next->rows - 1); y >= 0; y--)
{
p=GetVirtualPixels(next,0,y,next->columns,1,&next->exception);
if (p == (const PixelPacket *) NULL)
break;
bit=0;
byte=0;
for (x=0; x < (ssize_t) next->columns; x++)
{
byte<<=1;
if ((next->matte != MagickFalse) &&
(GetPixelOpacity(p) == (Quantum) TransparentOpacity))
byte|=0x01;
bit++;
if (bit == 8)
{
(void) WriteBlobByte(image,(unsigned char) byte);
bit=0;
byte=0;
}
p++;
}
if (bit != 0)
(void) WriteBlobByte(image,(unsigned char) (byte << (8-bit)));
for (i=0; i < (ssize_t) scanline_pad; i++)
(void) WriteBlobByte(image,(unsigned char) 0);
}
}
if (GetNextImageInList(next) == (Image *) NULL)
break;
status=SetImageProgress(next,SaveImagesTag,scene++,imageListLength);
if (status == MagickFalse)
break;
next=SyncNextImageInList(next);
} while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
offset=SeekBlob(image,0,SEEK_SET);
(void) offset;
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,1);
(void) WriteBlobLSBShort(image,(unsigned short) (scene+1));
scene=0;
next=(images != (Image *) NULL) ? images : image;
do
{
(void) WriteBlobByte(image,icon_file.directory[scene].width);
(void) WriteBlobByte(image,icon_file.directory[scene].height);
(void) WriteBlobByte(image,icon_file.directory[scene].colors);
(void) WriteBlobByte(image,icon_file.directory[scene].reserved);
(void) WriteBlobLSBShort(image,icon_file.directory[scene].planes);
(void) WriteBlobLSBShort(image,icon_file.directory[scene].bits_per_pixel);
(void) WriteBlobLSBLong(image,(unsigned int)
icon_file.directory[scene].size);
(void) WriteBlobLSBLong(image,(unsigned int)
icon_file.directory[scene].offset);
scene++;
next=SyncNextImageInList(next);
} while ((next != (Image *) NULL) && (image_info->adjoin != MagickFalse));
(void) CloseBlob(image);
images=DestroyImageList(images);
return(MagickTrue);
}
| 0
|
139,689
|
static void nfc_llcp_rx_skb(struct nfc_llcp_local *local, struct sk_buff *skb)
{
u8 dsap, ssap, ptype;
ptype = nfc_llcp_ptype(skb);
dsap = nfc_llcp_dsap(skb);
ssap = nfc_llcp_ssap(skb);
pr_debug("ptype 0x%x dsap 0x%x ssap 0x%x\n", ptype, dsap, ssap);
if (ptype != LLCP_PDU_SYMM)
print_hex_dump_debug("LLCP Rx: ", DUMP_PREFIX_OFFSET, 16, 1,
skb->data, skb->len, true);
switch (ptype) {
case LLCP_PDU_SYMM:
pr_debug("SYMM\n");
break;
case LLCP_PDU_UI:
pr_debug("UI\n");
nfc_llcp_recv_ui(local, skb);
break;
case LLCP_PDU_CONNECT:
pr_debug("CONNECT\n");
nfc_llcp_recv_connect(local, skb);
break;
case LLCP_PDU_DISC:
pr_debug("DISC\n");
nfc_llcp_recv_disc(local, skb);
break;
case LLCP_PDU_CC:
pr_debug("CC\n");
nfc_llcp_recv_cc(local, skb);
break;
case LLCP_PDU_DM:
pr_debug("DM\n");
nfc_llcp_recv_dm(local, skb);
break;
case LLCP_PDU_SNL:
pr_debug("SNL\n");
nfc_llcp_recv_snl(local, skb);
break;
case LLCP_PDU_I:
case LLCP_PDU_RR:
case LLCP_PDU_RNR:
pr_debug("I frame\n");
nfc_llcp_recv_hdlc(local, skb);
break;
case LLCP_PDU_AGF:
pr_debug("AGF frame\n");
nfc_llcp_recv_agf(local, skb);
break;
}
}
| 0
|
229,459
|
void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM(
GLenum target, GLsizei width, GLsizei height,
GLuint io_surface_id, GLuint plane) {
#if defined(OS_MACOSX)
if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) {
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: only supported on desktop GL.");
return;
}
IOSurfaceSupport* surface_support = IOSurfaceSupport::Initialize();
if (!surface_support) {
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: only supported on 10.6.");
return;
}
if (target != GL_TEXTURE_RECTANGLE_ARB) {
SetGLError(
GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: requires TEXTURE_RECTANGLE_ARB target");
return;
}
TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
if (!info) {
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: no rectangle texture bound");
return;
}
if (info == texture_manager()->GetDefaultTextureInfo(target)) {
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: can't bind default texture");
return;
}
CFTypeRef surface = surface_support->IOSurfaceLookup(io_surface_id);
if (!surface) {
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: no IOSurface with the given ID");
return;
}
ReleaseIOSurfaceForTexture(info->service_id());
texture_to_io_surface_map_.insert(
std::make_pair(info->service_id(), surface));
CGLContextObj context =
static_cast<CGLContextObj>(context_->GetHandle());
CGLError err = surface_support->CGLTexImageIOSurface2D(
context,
target,
GL_RGBA,
width,
height,
GL_BGRA,
GL_UNSIGNED_INT_8_8_8_8_REV,
surface,
plane);
if (err != kCGLNoError) {
SetGLError(
GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: error in CGLTexImageIOSurface2D");
return;
}
texture_manager()->SetLevelInfo(
info, target, 0, GL_RGBA, width, height, 1, 0,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true);
#else
SetGLError(GL_INVALID_OPERATION,
"glTexImageIOSurface2DCHROMIUM: not supported.");
#endif
}
| 0
|
412,415
|
static void snd_pcm_xrun_debug_write(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
struct snd_pcm_str *pstr = entry->private_data;
char line[64];
if (!snd_info_get_line(buffer, line, sizeof(line)))
pstr->xrun_debug = simple_strtoul(line, NULL, 10);
}
| 0
|
477,127
|
void iov_iter_revert(struct iov_iter *i, size_t unroll)
{
if (!unroll)
return;
if (WARN_ON(unroll > MAX_RW_COUNT))
return;
i->count += unroll;
if (unlikely(iov_iter_is_pipe(i))) {
struct pipe_inode_info *pipe = i->pipe;
unsigned int p_mask = pipe->ring_size - 1;
unsigned int i_head = i->head;
size_t off = i->iov_offset;
while (1) {
struct pipe_buffer *b = &pipe->bufs[i_head & p_mask];
size_t n = off - b->offset;
if (unroll < n) {
off -= unroll;
break;
}
unroll -= n;
if (!unroll && i_head == i->start_head) {
off = 0;
break;
}
i_head--;
b = &pipe->bufs[i_head & p_mask];
off = b->offset + b->len;
}
i->iov_offset = off;
i->head = i_head;
pipe_truncate(i);
return;
}
if (unlikely(iov_iter_is_discard(i)))
return;
if (unroll <= i->iov_offset) {
i->iov_offset -= unroll;
return;
}
unroll -= i->iov_offset;
if (iov_iter_is_xarray(i)) {
BUG(); /* We should never go beyond the start of the specified
* range since we might then be straying into pages that
* aren't pinned.
*/
} else if (iov_iter_is_bvec(i)) {
const struct bio_vec *bvec = i->bvec;
while (1) {
size_t n = (--bvec)->bv_len;
i->nr_segs++;
if (unroll <= n) {
i->bvec = bvec;
i->iov_offset = n - unroll;
return;
}
unroll -= n;
}
} else { /* same logics for iovec and kvec */
const struct iovec *iov = i->iov;
while (1) {
size_t n = (--iov)->iov_len;
i->nr_segs++;
if (unroll <= n) {
i->iov = iov;
i->iov_offset = n - unroll;
return;
}
unroll -= n;
}
}
}
| 0
|
421,262
|
static int FAST_FUNC read_optset(const char *line, void *arg) {
return udhcp_str2optset(line, arg,
dhcp_optflags, dhcp_option_strings,
/*dhcpv6:*/ 0
);
}
| 0
|
468,109
|
blk_get_flush_queue(struct request_queue *q, struct blk_mq_ctx *ctx)
{
return blk_mq_map_queue(q, REQ_OP_FLUSH, ctx)->fq;
}
| 0
|
188,481
|
void setFixedFontFamilyWrapper(WebSettings* settings,
const string16& font,
UScriptCode script) {
settings->setFixedFontFamily(font, script);
}
| 0
|
340,599
|
void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
{
QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
QXLCursor *cursor;
QEMUCursor *c;
if (!qxl->ssd.ds->mouse_set || !qxl->ssd.ds->cursor_define) {
return;
}
if (qxl->debug > 1 && cmd->type != QXL_CURSOR_MOVE) {
fprintf(stderr, "%s", __FUNCTION__);
qxl_log_cmd_cursor(qxl, cmd, ext->group_id);
fprintf(stderr, "\n");
}
switch (cmd->type) {
case QXL_CURSOR_SET:
cursor = qxl_phys2virt(qxl, cmd->u.set.shape, ext->group_id);
if (cursor->chunk.data_size != cursor->data_size) {
fprintf(stderr, "%s: multiple chunks\n", __FUNCTION__);
return;
}
c = qxl_cursor(qxl, cursor);
if (c == NULL) {
c = cursor_builtin_left_ptr();
}
qemu_mutex_lock(&qxl->ssd.lock);
if (qxl->ssd.cursor) {
cursor_put(qxl->ssd.cursor);
}
qxl->ssd.cursor = c;
qxl->ssd.mouse_x = cmd->u.set.position.x;
qxl->ssd.mouse_y = cmd->u.set.position.y;
qemu_mutex_unlock(&qxl->ssd.lock);
break;
case QXL_CURSOR_MOVE:
qemu_mutex_lock(&qxl->ssd.lock);
qxl->ssd.mouse_x = cmd->u.position.x;
qxl->ssd.mouse_y = cmd->u.position.y;
qemu_mutex_unlock(&qxl->ssd.lock);
break;
}
}
| 0
|
443,783
|
bool RGWCORSRule::is_origin_present(const char *o) {
string origin = o;
return is_string_in_set(allowed_origins, origin);
}
| 0
|
464,155
|
nm_utils_machine_id_str(void)
{
return _machine_id_get(TRUE)->str;
}
| 0
|
371,731
|
get_dir_list_from_path (FrWindow *window,
char *path)
{
char *dirname;
int dirname_l;
GList *list = NULL;
int i;
if (path[strlen (path) - 1] != '/')
dirname = g_strconcat (path, "/", NULL);
else
dirname = g_strdup (path);
dirname_l = strlen (dirname);
for (i = 0; i < window->archive->files->len; i++) {
FileData *fd = g_ptr_array_index (window->archive->files, i);
gboolean matches = FALSE;
#ifdef DEBUG_GET_DIR_LIST_FROM_PATH
g_print ("%s <=> %s (%d)\n", dirname, fd->full_path, dirname_l);
#endif
if (fd->dir) {
int full_path_l = strlen (fd->full_path);
if ((full_path_l == dirname_l - 1) && (strncmp (dirname, fd->full_path, full_path_l) == 0))
/* example: dirname is '/path/to/dir/' and fd->full_path is '/path/to/dir' */
matches = TRUE;
else if (strcmp (dirname, fd->full_path) == 0)
matches = TRUE;
}
if (! matches && strncmp (dirname, fd->full_path, dirname_l) == 0) {
matches = TRUE;
}
if (matches) {
#ifdef DEBUG_GET_DIR_LIST_FROM_PATH
g_print ("`-> OK\n");
#endif
list = g_list_prepend (list, g_strdup (fd->original_path));
}
}
g_free (dirname);
return g_list_reverse (list);
}
| 0
|
385,064
|
static inline php_stream *phar_get_entrypfp(phar_entry_info *entry TSRMLS_DC)
{
if (!entry->is_persistent) {
return entry->phar->fp;
}
return PHAR_GLOBALS->cached_fp[entry->phar->phar_pos].fp;
}
| 0
|
273,181
|
Word getUpstreamDataBufferBytesHandler(void* raw_context, Word start, Word length, Word ptr_ptr,
Word size_ptr) {
auto context = WASM_CONTEXT(raw_context);
absl::string_view data;
auto result = context->getUpstreamDataBufferBytes(start.u64_, length.u64_, &data);
if (result != WasmResult::Ok) {
return wasmResultToWord(result);
}
context->wasm()->copyToPointerSize(data, ptr_ptr.u64_, size_ptr.u64_);
return wasmResultToWord(WasmResult::Ok);
}
| 0
|
93,004
|
_Unpickler_ReadFromFile(UnpicklerObject *self, Py_ssize_t n)
{
PyObject *data;
Py_ssize_t read_size;
assert(self->read != NULL);
if (_Unpickler_SkipConsumed(self) < 0)
return -1;
if (n == READ_WHOLE_LINE) {
data = _PyObject_CallNoArg(self->readline);
}
else {
PyObject *len;
/* Prefetch some data without advancing the file pointer, if possible */
if (self->peek && n < PREFETCH) {
len = PyLong_FromSsize_t(PREFETCH);
if (len == NULL)
return -1;
data = _Pickle_FastCall(self->peek, len);
if (data == NULL) {
if (!PyErr_ExceptionMatches(PyExc_NotImplementedError))
return -1;
/* peek() is probably not supported by the given file object */
PyErr_Clear();
Py_CLEAR(self->peek);
}
else {
read_size = _Unpickler_SetStringInput(self, data);
Py_DECREF(data);
self->prefetched_idx = 0;
if (n <= read_size)
return n;
}
}
len = PyLong_FromSsize_t(n);
if (len == NULL)
return -1;
data = _Pickle_FastCall(self->read, len);
}
if (data == NULL)
return -1;
read_size = _Unpickler_SetStringInput(self, data);
Py_DECREF(data);
return read_size;
}
| 0
|
404,008
|
bool ptr_is_within_mem_clumps(const void *ptr, gs_ref_memory_t *mem)
{
clump_t *cp = mem->root;
while (cp)
{
if (PTR_LT(ptr, cp->cbase))
{
cp = cp->left;
continue;
}
if (PTR_GE(ptr, cp->cend))
{
cp = cp->right;
continue;
}
/* Found it! */
splay_move_to_root(cp, mem);
return true;
}
return false;
}
| 0
|
184,063
|
void OverlayWindowViews::SetPictureInPictureCustomControls(
const std::vector<blink::PictureInPictureControlInfo>& controls) {
first_custom_controls_view_.reset();
second_custom_controls_view_.reset();
if (controls.size() > 0)
CreateCustomControl(first_custom_controls_view_, controls[0],
ControlPosition::kLeft);
if (controls.size() > 1)
CreateCustomControl(second_custom_controls_view_, controls[1],
ControlPosition::kRight);
}
| 0
|
348,572
|
void JPXStream::init()
{
Object oLen, cspace, smaskInData;
if (getDict()) {
oLen = getDict()->lookup("Length");
cspace = getDict()->lookup("ColorSpace");
smaskInData = getDict()->lookup("SMaskInData");
}
int bufSize = BUFFER_INITIAL_SIZE;
if (oLen.isInt()) bufSize = oLen.getInt();
bool indexed = false;
if (cspace.isArray() && cspace.arrayGetLength() > 0) {
const Object cstype = cspace.arrayGet(0);
if (cstype.isName("Indexed")) indexed = true;
}
priv->smaskInData = 0;
if (smaskInData.isInt()) priv->smaskInData = smaskInData.getInt();
int length = 0;
unsigned char *buf = str->toUnsignedChars(&length, bufSize);
priv->init2(OPJ_CODEC_JP2, buf, length, indexed);
gfree(buf);
if (priv->image) {
int numComps = (priv->image) ? priv->image->numcomps : 1;
int alpha = 0;
if (priv->image) {
if (priv->image->color_space == OPJ_CLRSPC_SRGB && numComps == 4) { numComps = 3; alpha = 1; }
else if (priv->image->color_space == OPJ_CLRSPC_SYCC && numComps == 4) { numComps = 3; alpha = 1; }
else if (numComps == 2) { numComps = 1; alpha = 1; }
else if (numComps > 4) { numComps = 4; alpha = 1; }
else { alpha = 0; }
}
priv->npixels = priv->image->comps[0].w * priv->image->comps[0].h;
priv->ncomps = priv->image->numcomps;
if (alpha == 1 && priv->smaskInData == 0) priv->ncomps--;
for (int component = 0; component < priv->ncomps; component++) {
if (priv->image->comps[component].data == nullptr) {
close();
break;
}
unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
int adjust = 0;
int depth = priv->image->comps[component].prec;
if (priv->image->comps[component].prec > 8)
adjust = priv->image->comps[component].prec - 8;
int sgndcorr = 0;
if (priv->image->comps[component].sgnd)
sgndcorr = 1 << (priv->image->comps[0].prec - 1);
for (int i = 0; i < priv->npixels; i++) {
int r = priv->image->comps[component].data[i];
*(cdata++) = adjustComp(r, adjust, depth, sgndcorr, indexed);
}
}
} else {
priv->npixels = 0;
}
priv->counter = 0;
priv->ccounter = 0;
priv->inited = true;
}
| 1
|
373,878
|
bool fieldsMatch(const BSONObj& lhs, const BSONObj& rhs) {
BSONObjIterator l(lhs);
BSONObjIterator r(rhs);
while (l.more() && r.more()){
if (strcmp(l.next().fieldName(), r.next().fieldName())) {
return false;
}
}
return !(l.more() || r.more()); // false if lhs and rhs have diff nFields()
}
| 0
|
413,709
|
getCharOrDots(widechar c, int m, TranslationTableHeader *table) {
CharOrDots *cdPtr;
TranslationTableOffset bucket;
unsigned long int makeHash = (unsigned long int)c % HASHNUM;
if (m == 0)
bucket = table->charToDots[makeHash];
else
bucket = table->dotsToChar[makeHash];
while (bucket) {
cdPtr = (CharOrDots *)&table->ruleArea[bucket];
if (cdPtr->lookFor == c) return cdPtr;
bucket = cdPtr->next;
}
return NULL;
}
| 0
|
467,560
|
EXPORTED int annotatemore_msg_lookup(const char *mboxname, uint32_t uid, const char *entry,
const char *userid, struct buf *value)
{
char key[MAX_MAILBOX_PATH+1];
size_t keylen, datalen;
int r;
const char *data;
annotate_db_t *d = NULL;
struct annotate_metadata mdata;
init_internal();
r = _annotate_getdb(mboxname, uid, 0, &d);
if (r)
return (r == CYRUSDB_NOTFOUND ? 0 : r);
keylen = make_key(mboxname, uid, entry, userid, key, sizeof(key));
do {
r = cyrusdb_fetch(d->db, key, keylen, &data, &datalen, tid(d));
} while (r == CYRUSDB_AGAIN);
if (!r && data) {
r = split_attribs(data, datalen, value, &mdata);
if (!r) {
/* Force a copy, in case the putdb() call destroys
* the per-db data area that @data points to. */
buf_cstring(value);
}
if (mdata.flags & ANNOTATE_FLAG_DELETED) {
buf_free(value);
r = CYRUSDB_NOTFOUND;
}
}
if (r == CYRUSDB_NOTFOUND) r = 0;
annotate_putdb(&d);
return r;
}
| 0
|
60,321
|
ufmt_close(UFormattable *fmt) {
Formattable *obj = Formattable::fromUFormattable(fmt);
delete obj;
}
| 0
|
84,830
|
int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
const struct nlmsghdr *nlh,
struct netlink_dump_control *control)
{
struct netlink_callback *cb;
struct sock *sk;
struct netlink_sock *nlk;
int ret;
atomic_inc(&skb->users);
sk = netlink_lookup(sock_net(ssk), ssk->sk_protocol, NETLINK_CB(skb).portid);
if (sk == NULL) {
ret = -ECONNREFUSED;
goto error_free;
}
nlk = nlk_sk(sk);
mutex_lock(nlk->cb_mutex);
/* A dump is in progress... */
if (nlk->cb_running) {
ret = -EBUSY;
goto error_unlock;
}
/* add reference of module which cb->dump belongs to */
if (!try_module_get(control->module)) {
ret = -EPROTONOSUPPORT;
goto error_unlock;
}
cb = &nlk->cb;
memset(cb, 0, sizeof(*cb));
cb->start = control->start;
cb->dump = control->dump;
cb->done = control->done;
cb->nlh = nlh;
cb->data = control->data;
cb->module = control->module;
cb->min_dump_alloc = control->min_dump_alloc;
cb->skb = skb;
nlk->cb_running = true;
mutex_unlock(nlk->cb_mutex);
if (cb->start)
cb->start(cb);
ret = netlink_dump(sk);
sock_put(sk);
if (ret)
return ret;
/* We successfully started a dump, by returning -EINTR we
* signal not to send ACK even if it was requested.
*/
return -EINTR;
error_unlock:
sock_put(sk);
mutex_unlock(nlk->cb_mutex);
error_free:
kfree_skb(skb);
return ret;
}
| 0
|
155,433
|
__releases(&hb->lock)
{
__queue_me(q, hb);
spin_unlock(&hb->lock);
}
| 0
|
413,476
|
static void _slurm_rpc_dump_node_single(slurm_msg_t * msg)
{
DEF_TIMERS;
char *dump;
int dump_size;
slurm_msg_t response_msg;
node_info_single_msg_t *node_req_msg =
(node_info_single_msg_t *) msg->data;
/* Locks: Read config, read node, read part (for part_is_visible) */
slurmctld_lock_t node_write_lock = {
READ_LOCK, NO_LOCK, READ_LOCK, READ_LOCK, NO_LOCK };
uid_t uid = g_slurm_auth_get_uid(msg->auth_cred,
slurmctld_config.auth_info);
START_TIMER;
debug3("Processing RPC: REQUEST_NODE_INFO_SINGLE from uid=%d", uid);
if ((slurmctld_conf.private_data & PRIVATE_DATA_NODES) &&
(!validate_operator(uid))) {
error("Security violation, REQUEST_NODE_INFO_SINGLE RPC from "
"uid=%d", uid);
slurm_send_rc_msg(msg, ESLURM_ACCESS_DENIED);
return;
}
lock_slurmctld(node_write_lock);
#if 0
/* This function updates each node's alloc_cpus count and too slow for
* our use here. Node write lock is needed if this function is used */
select_g_select_nodeinfo_set_all();
#endif
pack_one_node(&dump, &dump_size, node_req_msg->show_flags,
uid, node_req_msg->node_name, msg->protocol_version);
unlock_slurmctld(node_write_lock);
END_TIMER2("_slurm_rpc_dump_node_single");
#if 0
info("_slurm_rpc_dump_node_single, name=%s size=%d %s",
node_req_msg->node_name, dump_size, TIME_STR);
#endif
/* init response_msg structure */
slurm_msg_t_init(&response_msg);
response_msg.flags = msg->flags;
response_msg.protocol_version = msg->protocol_version;
response_msg.address = msg->address;
response_msg.conn = msg->conn;
response_msg.msg_type = RESPONSE_NODE_INFO;
response_msg.data = dump;
response_msg.data_size = dump_size;
/* send message */
slurm_send_node_msg(msg->conn_fd, &response_msg);
xfree(dump);
}
| 0
|
207,162
|
sk_deep_copy(void *sk_void, void *copy_func_void, void *free_func_void)
{
_STACK *sk = sk_void;
void *(*copy_func)(void *) = copy_func_void;
void (*free_func)(void *) = free_func_void;
_STACK *ret = sk_dup(sk);
size_t i;
if (ret == NULL)
return NULL;
for (i = 0; i < ret->num; i++) {
if (ret->data[i] == NULL)
continue;
ret->data[i] = copy_func(ret->data[i]);
if (ret->data[i] == NULL) {
size_t j;
for (j = 0; j < i; j++) {
if (ret->data[j] != NULL)
free_func(ret->data[j]);
}
sk_free(ret);
return NULL;
}
}
return ret;
}
| 0
|
416,590
|
gx_get_largest_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
{
pbox->p.x = min_fixed;
pbox->p.y = min_fixed;
pbox->q.x = max_fixed;
pbox->q.y = max_fixed;
}
| 0
|
374,573
|
_equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateForeignServerStmt *b)
{
COMPARE_STRING_FIELD(servername);
COMPARE_STRING_FIELD(servertype);
COMPARE_STRING_FIELD(version);
COMPARE_STRING_FIELD(fdwname);
COMPARE_NODE_FIELD(options);
return true;
}
| 0
|
489,143
|
char *split_comma(char *str) {
if (str == NULL || *str == '\0')
return NULL;
char *ptr = strchr(str, ',');
if (!ptr)
return NULL;
*ptr = '\0';
ptr++;
if (*ptr == '\0')
return NULL;
return ptr;
}
| 0
|
158,053
|
ves_icall_MonoType_get_Name (MonoReflectionType *type)
{
MonoDomain *domain = mono_domain_get ();
MonoClass *class = mono_class_from_mono_type (type->type);
MONO_ARCH_SAVE_REGS;
if (type->type->byref) {
char *n = g_strdup_printf ("%s&", class->name);
MonoString *res = mono_string_new (domain, n);
g_free (n);
return res;
} else {
return mono_string_new (domain, class->name);
}
}
| 0
|
319,874
|
static inline void gen_efdnabs(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
tcg_gen_ori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], 0x8000000000000000LL);
#else
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
tcg_gen_ori_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)], 0x80000000);
#endif
}
| 0
|
121,500
|
compile_length_string_raw_node(StrNode* sn, regex_t* reg)
{
if (sn->end <= sn->s)
return 0;
return add_compile_string_length(sn->s, 1 /* sb */, (int )(sn->end - sn->s),
reg, 0);
}
| 0
|
238,884
|
static int register_memsw_files(struct cgroup *cont, struct cgroup_subsys *ss)
{
if (!do_swap_account)
return 0;
return cgroup_add_files(cont, ss, memsw_cgroup_files,
ARRAY_SIZE(memsw_cgroup_files));
};
| 0
|
8,487
|
void CWebServer::GetFloorplanImage(WebEmSession & session, const request& req, reply & rep)
{
std::string idx = request::findValue(&req, "idx");
if (idx == "") {
return;
}
std::vector<std::vector<std::string> > result;
result = m_sql.safe_queryBlob("SELECT Image FROM Floorplans WHERE ID=%s", idx.c_str());
if (result.empty())
return;
reply::set_content(&rep, result[0][0].begin(), result[0][0].end());
std::string oname = "floorplan";
if (result[0][0].size() > 10)
{
if (result[0][0][0] == 'P')
oname += ".png";
else if (result[0][0][0] == -1)
oname += ".jpg";
else if (result[0][0][0] == 'B')
oname += ".bmp";
else if (result[0][0][0] == 'G')
oname += ".gif";
}
reply::add_header_attachment(&rep, oname);
}
| 1
|
461,457
|
static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu, V9fsPath *path,
const char *basename,
const struct stat *stbuf,
V9fsStat *v9stat)
{
int err;
memset(v9stat, 0, sizeof(*v9stat));
err = stat_to_qid(pdu, stbuf, &v9stat->qid);
if (err < 0) {
return err;
}
v9stat->mode = stat_to_v9mode(stbuf);
v9stat->atime = stbuf->st_atime;
v9stat->mtime = stbuf->st_mtime;
v9stat->length = stbuf->st_size;
v9fs_string_free(&v9stat->uid);
v9fs_string_free(&v9stat->gid);
v9fs_string_free(&v9stat->muid);
v9stat->n_uid = stbuf->st_uid;
v9stat->n_gid = stbuf->st_gid;
v9stat->n_muid = 0;
v9fs_string_free(&v9stat->extension);
if (v9stat->mode & P9_STAT_MODE_SYMLINK) {
err = v9fs_co_readlink(pdu, path, &v9stat->extension);
if (err < 0) {
return err;
}
} else if (v9stat->mode & P9_STAT_MODE_DEVICE) {
v9fs_string_sprintf(&v9stat->extension, "%c %u %u",
S_ISCHR(stbuf->st_mode) ? 'c' : 'b',
major(stbuf->st_rdev), minor(stbuf->st_rdev));
} else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) {
v9fs_string_sprintf(&v9stat->extension, "%s %lu",
"HARDLINKCOUNT", (unsigned long)stbuf->st_nlink);
}
v9fs_string_sprintf(&v9stat->name, "%s", basename);
v9stat->size = 61 +
v9fs_string_size(&v9stat->name) +
v9fs_string_size(&v9stat->uid) +
v9fs_string_size(&v9stat->gid) +
v9fs_string_size(&v9stat->muid) +
v9fs_string_size(&v9stat->extension);
return 0;
}
| 0
|
295,547
|
sshpkt_send(struct ssh *ssh)
{
if (compat20)
return ssh_packet_send2(ssh);
else
return ssh_packet_send1(ssh);
}
| 0
|
190,711
|
StringValue* MakeEnumValue(T t, const char* (*converter_fn)(T)) {
return Value::CreateStringValue(converter_fn(t));
}
| 0
|
407,007
|
static void insert_part_info_log_entry_list(partition_info *part_info,
DDL_LOG_MEMORY_ENTRY *log_entry)
{
log_entry->next_active_log_entry= part_info->first_log_entry;
part_info->first_log_entry= log_entry;
}
| 0
|
380,508
|
evbuffer_free(struct evbuffer *buffer)
{
EVBUFFER_LOCK(buffer);
evbuffer_decref_and_unlock_(buffer);
}
| 0
|
111,812
|
static void digi_close(struct usb_serial_port *port)
{
DEFINE_WAIT(wait);
int ret;
unsigned char buf[32];
struct digi_port *priv = usb_get_serial_port_data(port);
mutex_lock(&port->serial->disc_mutex);
/* if disconnected, just clear flags */
if (port->serial->disconnected)
goto exit;
/* FIXME: Transmit idle belongs in the wait_unti_sent path */
digi_transmit_idle(port, DIGI_CLOSE_TIMEOUT);
/* disable input flow control */
buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL;
buf[1] = priv->dp_port_num;
buf[2] = DIGI_DISABLE;
buf[3] = 0;
/* disable output flow control */
buf[4] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL;
buf[5] = priv->dp_port_num;
buf[6] = DIGI_DISABLE;
buf[7] = 0;
/* disable reading modem signals automatically */
buf[8] = DIGI_CMD_READ_INPUT_SIGNALS;
buf[9] = priv->dp_port_num;
buf[10] = DIGI_DISABLE;
buf[11] = 0;
/* disable receive */
buf[12] = DIGI_CMD_RECEIVE_ENABLE;
buf[13] = priv->dp_port_num;
buf[14] = DIGI_DISABLE;
buf[15] = 0;
/* flush fifos */
buf[16] = DIGI_CMD_IFLUSH_FIFO;
buf[17] = priv->dp_port_num;
buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX;
buf[19] = 0;
ret = digi_write_oob_command(port, buf, 20, 0);
if (ret != 0)
dev_dbg(&port->dev, "digi_close: write oob failed, ret=%d\n",
ret);
/* wait for final commands on oob port to complete */
prepare_to_wait(&priv->dp_flush_wait, &wait,
TASK_INTERRUPTIBLE);
schedule_timeout(DIGI_CLOSE_TIMEOUT);
finish_wait(&priv->dp_flush_wait, &wait);
/* shutdown any outstanding bulk writes */
usb_kill_urb(port->write_urb);
exit:
spin_lock_irq(&priv->dp_port_lock);
priv->dp_write_urb_in_use = 0;
wake_up_interruptible(&priv->dp_close_wait);
spin_unlock_irq(&priv->dp_port_lock);
mutex_unlock(&port->serial->disc_mutex);
}
| 0
|
33,543
|
entry_guards_note_guard_success(guard_selection_t *gs,
entry_guard_t *guard,
unsigned old_state)
{
tor_assert(gs);
/* Save this, since we're about to overwrite it. */
const time_t last_time_on_internet = gs->last_time_on_internet;
gs->last_time_on_internet = approx_time();
guard->is_reachable = GUARD_REACHABLE_YES;
guard->failing_since = 0;
guard->is_pending = 0;
if (guard->is_filtered_guard)
guard->is_usable_filtered_guard = 1;
if (guard->confirmed_idx < 0) {
make_guard_confirmed(gs, guard);
if (!gs->primary_guards_up_to_date)
entry_guards_update_primary(gs);
}
unsigned new_state;
switch (old_state) {
case GUARD_CIRC_STATE_COMPLETE:
case GUARD_CIRC_STATE_USABLE_ON_COMPLETION:
new_state = GUARD_CIRC_STATE_COMPLETE;
break;
default:
tor_assert_nonfatal_unreached();
/* Fall through. */
case GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD:
if (guard->is_primary) {
/* XXXX #20832 -- I don't actually like this logic. It seems to make
* us a little more susceptible to evil-ISP attacks. The mitigations
* I'm thinking of, however, aren't local to this point, so I'll leave
* it alone. */
/* This guard may have become primary by virtue of being confirmed.
* If so, the circuit for it is now complete.
*/
new_state = GUARD_CIRC_STATE_COMPLETE;
} else {
new_state = GUARD_CIRC_STATE_WAITING_FOR_BETTER_GUARD;
}
break;
}
if (! guard->is_primary) {
if (last_time_on_internet + get_internet_likely_down_interval()
< approx_time()) {
mark_primary_guards_maybe_reachable(gs);
}
}
log_info(LD_GUARD, "Recorded success for %s%sguard %s",
guard->is_primary?"primary ":"",
guard->confirmed_idx>=0?"confirmed ":"",
entry_guard_describe(guard));
return new_state;
}
| 0
|
64,059
|
static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen)
{
int mpalen;
struct tx_data_wr *req;
struct mpa_message *mpa;
int len;
struct sk_buff *skb;
PDBG("%s ep %p plen %d\n", __func__, ep, plen);
mpalen = sizeof(*mpa) + plen;
skb = get_skb(NULL, mpalen + sizeof(*req), GFP_KERNEL);
if (!skb) {
printk(KERN_ERR MOD "%s - cannot alloc skb!\n", __func__);
return -ENOMEM;
}
skb->priority = CPL_PRIORITY_DATA;
skb_reserve(skb, sizeof(*req));
mpa = (struct mpa_message *) skb_put(skb, mpalen);
memset(mpa, 0, sizeof(*mpa));
memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key));
mpa->flags = (ep->mpa_attr.crc_enabled ? MPA_CRC : 0) |
(markers_enabled ? MPA_MARKERS : 0);
mpa->revision = mpa_rev;
mpa->private_data_size = htons(plen);
if (plen)
memcpy(mpa->private_data, pdata, plen);
/*
* Reference the mpa skb. This ensures the data area
* will remain in memory until the hw acks the tx.
* Function tx_ack() will deref it.
*/
skb_get(skb);
set_arp_failure_handler(skb, arp_failure_discard);
skb_reset_transport_header(skb);
len = skb->len;
req = (struct tx_data_wr *) skb_push(skb, sizeof(*req));
req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA)|F_WR_COMPL);
req->wr_lo = htonl(V_WR_TID(ep->hwtid));
req->len = htonl(len);
req->param = htonl(V_TX_PORT(ep->l2t->smt_idx) |
V_TX_SNDBUF(snd_win>>15));
req->flags = htonl(F_TX_INIT);
req->sndseq = htonl(ep->snd_seq);
ep->mpa_skb = skb;
state_set(&ep->com, MPA_REP_SENT);
return iwch_l2t_send(ep->com.tdev, skb, ep->l2t);
}
| 0
|
466,247
|
TEST_P(DownstreamProtocolIntegrationTest, ConnectStreamRejection) {
// TODO(danzh) add "allow_connect" to http3 options.
EXCLUDE_DOWNSTREAM_HTTP3;
if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) {
return;
}
config_helper_.addConfigModifier(
[](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager&
hcm) -> void {
hcm.mutable_http3_protocol_options()
->mutable_override_stream_error_on_invalid_http_message()
->set_value(true);
hcm.mutable_http2_protocol_options()
->mutable_override_stream_error_on_invalid_http_message()
->set_value(true);
});
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));
auto response = codec_client_->makeHeaderOnlyRequest(Http::TestRequestHeaderMapImpl{
{":method", "CONNECT"}, {":path", "/"}, {":authority", "host"}});
ASSERT_TRUE(response->waitForReset());
EXPECT_FALSE(codec_client_->disconnected());
}
| 0
|
418,024
|
int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override {
return op->get_data_cb(bl, bl_ofs, bl_len);
}
| 0
|
90,725
|
static double mp_dot(_cimg_math_parser& mp) {
const unsigned int siz = (unsigned int)mp.opcode[4];
return CImg<doubleT>(&_mp_arg(2) + 1,1,siz,1,1,true).
dot(CImg<doubleT>(&_mp_arg(3) + 1,1,siz,1,1,true));
| 0
|
375,846
|
static int vmstate_n_elems(void *opaque, VMStateField *field)
{
int n_elems = 1;
if (field->flags & VMS_ARRAY) {
n_elems = field->num;
} else if (field->flags & VMS_VARRAY_INT32) {
n_elems = *(int32_t *)(opaque+field->num_offset);
} else if (field->flags & VMS_VARRAY_UINT32) {
n_elems = *(uint32_t *)(opaque+field->num_offset);
} else if (field->flags & VMS_VARRAY_UINT16) {
n_elems = *(uint16_t *)(opaque+field->num_offset);
} else if (field->flags & VMS_VARRAY_UINT8) {
n_elems = *(uint8_t *)(opaque+field->num_offset);
}
return n_elems;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.