idx
int64 | func
string | target
int64 |
|---|---|---|
90,173
|
virtual void RemoveCellularDataPlanObserver(
CellularDataPlanObserver* observer) {}
| 0
|
446,064
|
LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
{
static const char module[] = "LZWDecode";
LZWCodecState *sp = DecoderState(tif);
char *op = (char*) op0;
long occ = (long) occ0;
char *tp;
unsigned char *bp;
hcode_t code;
int len;
long nbits, nextbits, nbitsmask;
unsigned long nextdata;
code_t *codep, *free_entp, *maxcodep, *oldcodep;
(void) s;
assert(sp != NULL);
assert(sp->dec_codetab != NULL);
/*
Fail if value does not fit in long.
*/
if ((tmsize_t) occ != occ0)
return (0);
/*
* Restart interrupted output operation.
*/
if (sp->dec_restart) {
long residue;
codep = sp->dec_codep;
residue = codep->length - sp->dec_restart;
if (residue > occ) {
/*
* Residue from previous decode is sufficient
* to satisfy decode request. Skip to the
* start of the decoded string, place decoded
* values in the output buffer, and return.
*/
sp->dec_restart += occ;
do {
codep = codep->next;
} while (--residue > occ && codep);
if (codep) {
tp = op + occ;
do {
*--tp = codep->value;
codep = codep->next;
} while (--occ && codep);
}
return (1);
}
/*
* Residue satisfies only part of the decode request.
*/
op += residue;
occ -= residue;
tp = op;
do {
int t;
--tp;
t = codep->value;
codep = codep->next;
*tp = (char)t;
} while (--residue && codep);
sp->dec_restart = 0;
}
bp = (unsigned char *)tif->tif_rawcp;
#ifdef LZW_CHECKEOS
sp->dec_bitsleft = (((uint64)tif->tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata;
nextbits = sp->lzw_nextbits;
nbitsmask = sp->dec_nbitsmask;
oldcodep = sp->dec_oldcodep;
free_entp = sp->dec_free_entp;
maxcodep = sp->dec_maxcodep;
while (occ > 0) {
NextCode(tif, sp, bp, code, GetNextCode);
if (code == CODE_EOI)
break;
if (code == CODE_CLEAR) {
do {
free_entp = sp->dec_codetab + CODE_FIRST;
_TIFFmemset(free_entp, 0,
(CSIZE - CODE_FIRST) * sizeof (code_t));
nbits = BITS_MIN;
nbitsmask = MAXCODE(BITS_MIN);
maxcodep = sp->dec_codetab + nbitsmask-1;
NextCode(tif, sp, bp, code, GetNextCode);
} while (code == CODE_CLEAR); /* consecutive CODE_CLEAR codes */
if (code == CODE_EOI)
break;
if (code > CODE_CLEAR) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"LZWDecode: Corrupted LZW table at scanline %d",
tif->tif_row);
return (0);
}
*op++ = (char)code;
occ--;
oldcodep = sp->dec_codetab + code;
continue;
}
codep = sp->dec_codetab + code;
/*
* Add the new entry to the code table.
*/
if (free_entp < &sp->dec_codetab[0] ||
free_entp >= &sp->dec_codetab[CSIZE]) {
TIFFErrorExt(tif->tif_clientdata, module,
"Corrupted LZW table at scanline %d",
tif->tif_row);
return (0);
}
free_entp->next = oldcodep;
if (free_entp->next < &sp->dec_codetab[0] ||
free_entp->next >= &sp->dec_codetab[CSIZE]) {
TIFFErrorExt(tif->tif_clientdata, module,
"Corrupted LZW table at scanline %d",
tif->tif_row);
return (0);
}
free_entp->firstchar = free_entp->next->firstchar;
free_entp->length = free_entp->next->length+1;
free_entp->value = (codep < free_entp) ?
codep->firstchar : free_entp->firstchar;
if (++free_entp > maxcodep) {
if (++nbits > BITS_MAX) /* should not happen */
nbits = BITS_MAX;
nbitsmask = MAXCODE(nbits);
maxcodep = sp->dec_codetab + nbitsmask-1;
}
oldcodep = codep;
if (code >= 256) {
/*
* Code maps to a string, copy string
* value to output (written in reverse).
*/
if(codep->length == 0) {
TIFFErrorExt(tif->tif_clientdata, module,
"Wrong length of decoded string: "
"data probably corrupted at scanline %d",
tif->tif_row);
return (0);
}
if (codep->length > occ) {
/*
* String is too long for decode buffer,
* locate portion that will fit, copy to
* the decode buffer, and setup restart
* logic for the next decoding call.
*/
sp->dec_codep = codep;
do {
codep = codep->next;
} while (codep && codep->length > occ);
if (codep) {
sp->dec_restart = (long)occ;
tp = op + occ;
do {
*--tp = codep->value;
codep = codep->next;
} while (--occ && codep);
if (codep)
codeLoop(tif, module);
}
break;
}
len = codep->length;
tp = op + len;
do {
int t;
--tp;
t = codep->value;
codep = codep->next;
*tp = (char)t;
} while (codep && tp > op);
if (codep) {
codeLoop(tif, module);
break;
}
assert(occ >= len);
op += len;
occ -= len;
} else {
*op++ = (char)code;
occ--;
}
}
tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp );
tif->tif_rawcp = (uint8*) bp;
sp->lzw_nbits = (unsigned short) nbits;
sp->lzw_nextdata = nextdata;
sp->lzw_nextbits = nextbits;
sp->dec_nbitsmask = nbitsmask;
sp->dec_oldcodep = oldcodep;
sp->dec_free_entp = free_entp;
sp->dec_maxcodep = maxcodep;
if (occ > 0) {
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFErrorExt(tif->tif_clientdata, module,
"Not enough data at scanline %d (short %I64d bytes)",
tif->tif_row, (unsigned __int64) occ);
#else
TIFFErrorExt(tif->tif_clientdata, module,
"Not enough data at scanline %d (short %llu bytes)",
tif->tif_row, (unsigned long long) occ);
#endif
return (0);
}
return (1);
}
| 0
|
462,430
|
enqueueIoWork(epolld_t *epd, int dispatchInlineIfQueueFull) {
io_req_t *n;
int dispatchInline;
DEFiRet;
CHKmalloc(n = malloc(sizeof(io_req_t)));
n->epd = epd;
int inlineDispatchThreshold = DFLT_inlineDispatchThreshold * runModConf->wrkrMax;
dispatchInline = 0;
pthread_mutex_lock(&io_q.mut);
if (dispatchInlineIfQueueFull && io_q.sz > inlineDispatchThreshold) {
dispatchInline = 1;
} else {
STAILQ_INSERT_TAIL(&io_q.q, n, link);
io_q.sz++;
STATSCOUNTER_INC(io_q.ctrEnq, io_q.mutCtrEnq);
STATSCOUNTER_SETMAX_NOMUT(io_q.ctrMaxSz, io_q.sz);
pthread_cond_signal(&io_q.wakeup_worker);
}
pthread_mutex_unlock(&io_q.mut);
if (dispatchInline == 1) {
free(n);
processWorkItem(epd);
}
finalize_it:
if (iRet != RS_RET_OK) {
if (n == NULL) {
errmsg.LogError(0, iRet, "imptcp: couldn't allocate memory to enqueue io-request - ignored");
}
}
RETiRet;
}
| 0
|
482,549
|
freeTranslationTable(TranslationTableHeader *t) {
for (int i = 0; i < MAX_EMPH_CLASSES && t->emphClassNames[i]; i++)
free(t->emphClassNames[i]);
for (int i = 0; t->sourceFiles[i]; i++) free(t->sourceFiles[i]);
if (t->characterClasses) deallocateCharacterClasses(t);
if (t->ruleNames) deallocateRuleNames(t);
free(t);
}
| 0
|
276,986
|
~SampleEncrypter() {
delete m_StreamCipher;
}
| 0
|
317,315
|
static int selinux_setprocattr(const char *name, void *value, size_t size)
{
struct task_security_struct *tsec;
struct cred *new;
u32 mysid = current_sid(), sid = 0, ptsid;
int error;
char *str = value;
/*
* Basic control over ability to set these attributes at all.
*/
if (!strcmp(name, "exec"))
error = avc_has_perm(&selinux_state,
mysid, mysid, SECCLASS_PROCESS,
PROCESS__SETEXEC, NULL);
else if (!strcmp(name, "fscreate"))
error = avc_has_perm(&selinux_state,
mysid, mysid, SECCLASS_PROCESS,
PROCESS__SETFSCREATE, NULL);
else if (!strcmp(name, "keycreate"))
error = avc_has_perm(&selinux_state,
mysid, mysid, SECCLASS_PROCESS,
PROCESS__SETKEYCREATE, NULL);
else if (!strcmp(name, "sockcreate"))
error = avc_has_perm(&selinux_state,
mysid, mysid, SECCLASS_PROCESS,
PROCESS__SETSOCKCREATE, NULL);
else if (!strcmp(name, "current"))
error = avc_has_perm(&selinux_state,
mysid, mysid, SECCLASS_PROCESS,
PROCESS__SETCURRENT, NULL);
else
error = -EINVAL;
if (error)
return error;
/* Obtain a SID for the context, if one was specified. */
if (size && str[0] && str[0] != '\n') {
if (str[size-1] == '\n') {
str[size-1] = 0;
size--;
}
error = security_context_to_sid(&selinux_state, value, size,
&sid, GFP_KERNEL);
if (error == -EINVAL && !strcmp(name, "fscreate")) {
if (!has_cap_mac_admin(true)) {
struct audit_buffer *ab;
size_t audit_size;
/* We strip a nul only if it is at the end, otherwise the
* context contains a nul and we should audit that */
if (str[size - 1] == '\0')
audit_size = size - 1;
else
audit_size = size;
ab = audit_log_start(audit_context(),
GFP_ATOMIC,
AUDIT_SELINUX_ERR);
if (!ab)
return error;
audit_log_format(ab, "op=fscreate invalid_context=");
audit_log_n_untrustedstring(ab, value, audit_size);
audit_log_end(ab);
return error;
}
error = security_context_to_sid_force(
&selinux_state,
value, size, &sid);
}
if (error)
return error;
}
new = prepare_creds();
if (!new)
return -ENOMEM;
/* Permission checking based on the specified context is
performed during the actual operation (execve,
open/mkdir/...), when we know the full context of the
operation. See selinux_bprm_creds_for_exec for the execve
checks and may_create for the file creation checks. The
operation will then fail if the context is not permitted. */
tsec = selinux_cred(new);
if (!strcmp(name, "exec")) {
tsec->exec_sid = sid;
} else if (!strcmp(name, "fscreate")) {
tsec->create_sid = sid;
} else if (!strcmp(name, "keycreate")) {
if (sid) {
error = avc_has_perm(&selinux_state, mysid, sid,
SECCLASS_KEY, KEY__CREATE, NULL);
if (error)
goto abort_change;
}
tsec->keycreate_sid = sid;
} else if (!strcmp(name, "sockcreate")) {
tsec->sockcreate_sid = sid;
} else if (!strcmp(name, "current")) {
error = -EINVAL;
if (sid == 0)
goto abort_change;
/* Only allow single threaded processes to change context */
error = -EPERM;
if (!current_is_single_threaded()) {
error = security_bounded_transition(&selinux_state,
tsec->sid, sid);
if (error)
goto abort_change;
}
/* Check permissions for the transition. */
error = avc_has_perm(&selinux_state,
tsec->sid, sid, SECCLASS_PROCESS,
PROCESS__DYNTRANSITION, NULL);
if (error)
goto abort_change;
/* Check for ptracing, and update the task SID if ok.
Otherwise, leave SID unchanged and fail. */
ptsid = ptrace_parent_sid();
if (ptsid != 0) {
error = avc_has_perm(&selinux_state,
ptsid, sid, SECCLASS_PROCESS,
PROCESS__PTRACE, NULL);
if (error)
goto abort_change;
}
tsec->sid = sid;
} else {
error = -EINVAL;
goto abort_change;
}
commit_creds(new);
return size;
abort_change:
abort_creds(new);
return error;
}
| 0
|
337,779
|
static void sctp_asconf_param_success(struct sctp_association *asoc,
struct sctp_addip_param *asconf_param)
{
struct sctp_bind_addr *bp = &asoc->base.bind_addr;
union sctp_addr_param *addr_param;
struct sctp_sockaddr_entry *saddr;
struct sctp_transport *transport;
union sctp_addr addr;
struct sctp_af *af;
addr_param = (void *)asconf_param + sizeof(*asconf_param);
/* We have checked the packet before, so we do not check again. */
af = sctp_get_af_specific(param_type2af(addr_param->p.type));
if (!af->from_addr_param(&addr, addr_param, htons(bp->port), 0))
return;
switch (asconf_param->param_hdr.type) {
case SCTP_PARAM_ADD_IP:
/* This is always done in BH context with a socket lock
* held, so the list can not change.
*/
local_bh_disable();
list_for_each_entry(saddr, &bp->address_list, list) {
if (sctp_cmp_addr_exact(&saddr->a, &addr))
saddr->state = SCTP_ADDR_SRC;
}
local_bh_enable();
list_for_each_entry(transport, &asoc->peer.transport_addr_list,
transports) {
sctp_transport_dst_release(transport);
}
break;
case SCTP_PARAM_DEL_IP:
local_bh_disable();
sctp_del_bind_addr(bp, &addr);
if (asoc->asconf_addr_del_pending != NULL &&
sctp_cmp_addr_exact(asoc->asconf_addr_del_pending, &addr)) {
kfree(asoc->asconf_addr_del_pending);
asoc->asconf_addr_del_pending = NULL;
}
local_bh_enable();
list_for_each_entry(transport, &asoc->peer.transport_addr_list,
transports) {
sctp_transport_dst_release(transport);
}
break;
default:
break;
}
}
| 0
|
359,505
|
DEFUN (clear_bgp_as_soft,
clear_bgp_as_soft_cmd,
"clear bgp <1-65535> soft",
CLEAR_STR
BGP_STR
"Clear peers with the AS number\n"
"Soft reconfig\n")
{
return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
BGP_CLEAR_SOFT_BOTH, argv[0]);
}
| 0
|
292,206
|
inbound_login_start (session *sess, char *nick, char *servname,
const message_tags_data *tags_data)
{
inbound_newnick (sess->server, sess->server->nick, nick, TRUE, tags_data);
server_set_name (sess->server, servname);
if (sess->type == SESS_SERVER)
log_open_or_close (sess);
/* reset our away status */
if (sess->server->reconnect_away)
{
handle_command (sess->server->server_session, "away", FALSE);
sess->server->reconnect_away = FALSE;
}
}
| 0
|
139,251
|
void OverlayWindowViews::UpdateCustomControlsSize(
views::ControlImageButton* control_button) {
if (!control_button)
return;
UpdateButtonSize();
control_button->SetSize(button_size_);
if (control_button == first_custom_controls_view_.get()) {
first_custom_controls_view_->SetImage(
views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(vector_icons::kPlayArrowIcon,
button_size_.width() / 2, kControlIconColor));
}
if (control_button == second_custom_controls_view_.get()) {
second_custom_controls_view_->SetImage(
views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(vector_icons::kPauseIcon,
button_size_.width() / 2, kControlIconColor));
}
const gfx::ImageSkia control_background = gfx::CreateVectorIcon(
kPictureInPictureControlBackgroundIcon, button_size_.width(), kBgColor);
control_button->SetBackgroundImage(kBgColor, &control_background,
&control_background);
}
| 0
|
512,262
|
Item *get_copy(THD *thd)
{ return get_item_copy<Item_direct_ref>(thd, this); }
| 0
|
272,357
|
digest_get_encryption_oid(cms_context *cms)
{
int i = cms->selected_digest;
return digest_params[i].digest_encryption_tag;
}
| 0
|
513,107
|
Item_bool_rowready_func2 *Eq_creator::create(THD *thd, Item *a, Item *b) const
{
return new(thd->mem_root) Item_func_eq(thd, a, b);
}
| 0
|
245,199
|
get_table_name_from_tablespace(std::string &tablespace)
{
std::size_t pos = tablespace.find("`.`"); //`db`.`table` separator
if (pos != std::string::npos) {
tablespace = tablespace.substr(pos+3);
tablespace.erase(tablespace.size()-1); //remove leading `
}
}
| 0
|
195,338
|
static void naludmx_queue_param_set(GF_NALUDmxCtx *ctx, char *data, u32 size, u32 ps_type, s32 ps_id)
{
GF_List *list = NULL, *alt_list = NULL;
GF_NALUFFParam *sl;
u32 i, count;
u32 crc = gf_crc_32(data, size);
if (ctx->codecid==GF_CODECID_HEVC) {
switch (ps_type) {
case GF_HEVC_NALU_VID_PARAM:
if (!ctx->vps) ctx->vps = gf_list_new();
list = ctx->vps;
break;
case GF_HEVC_NALU_SEQ_PARAM:
list = ctx->sps;
break;
case GF_HEVC_NALU_PIC_PARAM:
list = ctx->pps;
break;
default:
assert(0);
return;
}
} else if (ctx->codecid==GF_CODECID_VVC) {
switch (ps_type) {
case GF_VVC_NALU_VID_PARAM:
if (!ctx->vps) ctx->vps = gf_list_new();
list = ctx->vps;
break;
case GF_VVC_NALU_SEQ_PARAM:
list = ctx->sps;
break;
case GF_VVC_NALU_PIC_PARAM:
list = ctx->pps;
break;
case GF_VVC_NALU_DEC_PARAM:
if (!ctx->vvc_dci) ctx->vvc_dci = gf_list_new();
list = ctx->vvc_dci;
break;
case GF_VVC_NALU_APS_PREFIX:
if (!ctx->vvc_aps_pre) ctx->vvc_aps_pre = gf_list_new();
list = ctx->vvc_aps_pre;
break;
default:
assert(0);
return;
}
} else {
switch (ps_type) {
case GF_AVC_NALU_SVC_SUBSEQ_PARAM:
case GF_AVC_NALU_SEQ_PARAM:
list = ctx->sps;
break;
case GF_AVC_NALU_PIC_PARAM:
list = ctx->pps;
alt_list = ctx->pps_svc;
break;
case GF_AVC_NALU_SEQ_PARAM_EXT:
if (!ctx->sps_ext) ctx->sps_ext = gf_list_new();
list = ctx->sps_ext;
break;
default:
assert(0);
return;
}
}
sl = NULL;
count = gf_list_count(list);
for (i=0; i<count; i++) {
sl = gf_list_get(list, i);
if (sl->id != ps_id) {
sl = NULL;
continue;
}
//same ID, same CRC, we don't change our state
if (sl->crc == crc) return;
break;
}
//handle alt PPS list for SVC
if (!sl && alt_list) {
count = gf_list_count(alt_list);
for (i=0; i<count; i++) {
sl = gf_list_get(alt_list, i);
if (sl->id != ps_id) {
sl = NULL;
continue;
}
//same ID, same CRC, we don't change our state
if (sl->crc == crc) return;
break;
}
}
if (sl) {
//otherwise we keep this new param set
sl->data = gf_realloc(sl->data, size);
memcpy(sl->data, data, size);
sl->size = size;
sl->crc = crc;
ctx->ps_modified = GF_TRUE;
return;
}
//TODO we might want to purge the list after a while !!
GF_SAFEALLOC(sl, GF_NALUFFParam);
if (!sl) return;
sl->data = gf_malloc(sizeof(char) * size);
if (!sl->data) {
gf_free(sl);
return;
}
memcpy(sl->data, data, size);
sl->size = size;
sl->id = ps_id;
sl->crc = crc;
ctx->ps_modified = GF_TRUE;
gf_list_add(list, sl);
}
| 1
|
401,584
|
static void numa_crng_init(void)
{
schedule_work(&numa_crng_init_work);
}
| 0
|
432,214
|
static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
{
unsigned access_size_max = mr->ops->valid.max_access_size;
/* Regions are assumed to support 1-4 byte accesses unless
otherwise specified. */
if (access_size_max == 0) {
access_size_max = 4;
}
/* Bound the maximum access by the alignment of the address. */
if (!mr->ops->impl.unaligned) {
#ifdef _MSC_VER
unsigned align_size_max = addr & (0ULL - addr);
#else
unsigned align_size_max = addr & -addr;
#endif
if (align_size_max != 0 && align_size_max < access_size_max) {
access_size_max = align_size_max;
}
}
/* Don't attempt accesses larger than the maximum. */
if (l > access_size_max) {
l = access_size_max;
}
l = pow2floor(l);
return l;
}
| 0
|
333,080
|
match_zref(
int subidx,
int *bytelen) // out: length of match in bytes
{
int len;
cleanup_zsubexpr();
if (re_extmatch_in == NULL || re_extmatch_in->matches[subidx] == NULL)
{
// backref was not set, match an empty string
*bytelen = 0;
return TRUE;
}
len = (int)STRLEN(re_extmatch_in->matches[subidx]);
if (cstrncmp(re_extmatch_in->matches[subidx], rex.input, &len) == 0)
{
*bytelen = len;
return TRUE;
}
return FALSE;
}
| 0
|
270,109
|
TfLiteStatus GetQuantizedConvolutionMultipler(TfLiteContext* context,
const TfLiteTensor* input,
const TfLiteTensor* filter,
const TfLiteTensor* bias,
TfLiteTensor* output,
double* multiplier) {
const double input_product_scale = static_cast<double>(input->params.scale) *
static_cast<double>(filter->params.scale);
// The following conditions must be guaranteed by the training pipeline.
if (bias) {
const double bias_scale = static_cast<double>(bias->params.scale);
// Here we're making sure the input_product_scale & bias_scale are about the
// same. Since we have:
// (output - output_zp) * output_scale =
// input_product_scale * input_product + bias * bias_scale ---- (0)
//
// (0) equals:
// (input_product + bias) * input_product_scale ----- (1)
// +
// bias * (bias_scale - input_product_scale) ------ (2)
//
// For the real kernel computation, we're doing (1), so we really need to
// make sure (2) has minimum impact on the output, so:
// bias * (bias_scale - input_product_scale) / output_scale should be
// a small number for an integer.
// Since normally bias should be within a small range.
// We should expect (bias_scale - input_product_scale) / output_scale to
// be a small number like 0.02.
const double scale_diff = std::abs(input_product_scale - bias_scale);
const double output_scale = static_cast<double>(output->params.scale);
TF_LITE_ENSURE(context, scale_diff / output_scale <= 0.02);
}
return GetQuantizedConvolutionMultipler(context, input, filter, output,
multiplier);
}
| 0
|
462,254
|
PJ_DEF(pj_status_t) pj_stun_msg_create_response(pj_pool_t *pool,
const pj_stun_msg *req_msg,
unsigned err_code,
const pj_str_t *err_msg,
pj_stun_msg **p_response)
{
unsigned msg_type = req_msg->hdr.type;
pj_stun_msg *response = NULL;
pj_status_t status;
PJ_ASSERT_RETURN(pool && p_response, PJ_EINVAL);
PJ_ASSERT_RETURN(PJ_STUN_IS_REQUEST(msg_type),
PJNATH_EINSTUNMSGTYPE);
/* Create response or error response */
if (err_code)
msg_type |= PJ_STUN_ERROR_RESPONSE_BIT;
else
msg_type |= PJ_STUN_SUCCESS_RESPONSE_BIT;
status = pj_stun_msg_create(pool, msg_type, req_msg->hdr.magic,
req_msg->hdr.tsx_id, &response);
if (status != PJ_SUCCESS) {
return status;
}
/* Add error code attribute */
if (err_code) {
status = pj_stun_msg_add_errcode_attr(pool, response,
err_code, err_msg);
if (status != PJ_SUCCESS) {
return status;
}
}
*p_response = response;
return PJ_SUCCESS;
}
| 0
|
336,626
|
SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s)
{
memset(s->config->taTicket.password, 0, sizeof(s->config->taTicket.password));
s->config->ticketing_enabled = FALSE;
return 0;
}
| 0
|
463,145
|
static int annotate_state_need_mbentry(annotate_state_t *state)
{
int r = 0;
if (!state->mbentry && state->mailbox) {
r = mboxlist_lookup(state->mailbox->name, &state->ourmbentry, NULL);
if (r) {
syslog(LOG_ERR, "Failed to lookup mbentry for %s: %s",
state->mailbox->name, error_message(r));
goto out;
}
state->mbentry = state->ourmbentry;
}
out:
return r;
}
| 0
|
389,715
|
func_equal(
typval_T *tv1,
typval_T *tv2,
int ic) // ignore case
{
char_u *s1, *s2;
dict_T *d1, *d2;
int a1, a2;
int i;
// empty and NULL function name considered the same
s1 = tv1->v_type == VAR_FUNC ? tv1->vval.v_string
: partial_name(tv1->vval.v_partial);
if (s1 != NULL && *s1 == NUL)
s1 = NULL;
s2 = tv2->v_type == VAR_FUNC ? tv2->vval.v_string
: partial_name(tv2->vval.v_partial);
if (s2 != NULL && *s2 == NUL)
s2 = NULL;
if (s1 == NULL || s2 == NULL)
{
if (s1 != s2)
return FALSE;
}
else if (STRCMP(s1, s2) != 0)
return FALSE;
// empty dict and NULL dict is different
d1 = tv1->v_type == VAR_FUNC ? NULL : tv1->vval.v_partial->pt_dict;
d2 = tv2->v_type == VAR_FUNC ? NULL : tv2->vval.v_partial->pt_dict;
if (d1 == NULL || d2 == NULL)
{
if (d1 != d2)
return FALSE;
}
else if (!dict_equal(d1, d2, ic, TRUE))
return FALSE;
// empty list and no list considered the same
a1 = tv1->v_type == VAR_FUNC ? 0 : tv1->vval.v_partial->pt_argc;
a2 = tv2->v_type == VAR_FUNC ? 0 : tv2->vval.v_partial->pt_argc;
if (a1 != a2)
return FALSE;
for (i = 0; i < a1; ++i)
if (!tv_equal(tv1->vval.v_partial->pt_argv + i,
tv2->vval.v_partial->pt_argv + i, ic, TRUE))
return FALSE;
return TRUE;
}
| 0
|
281,097
|
static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
{
struct net *net = xp_net(pol);
list_add(&pol->walk.all, &net->xfrm.policy_all);
net->xfrm.policy_count[dir]++;
xfrm_pol_hold(pol);
}
| 0
|
418,781
|
mouse_has(int c)
{
char_u *p;
for (p = p_mouse; *p; ++p)
switch (*p)
{
case 'a': if (vim_strchr((char_u *)MOUSE_A, c) != NULL)
return TRUE;
break;
case MOUSE_HELP: if (c != MOUSE_RETURN && curbuf->b_help)
return TRUE;
break;
default: if (c == *p) return TRUE; break;
}
return FALSE;
}
| 0
|
513,153
|
sys_var *find_plugin_sysvar(st_plugin_int *plugin, st_mysql_sys_var *plugin_var)
{
for (sys_var *var= plugin->system_vars; var; var= var->next)
{
sys_var_pluginvar *pvar=var->cast_pluginvar();
if (pvar->plugin_var == plugin_var)
return var;
}
return 0;
}
| 0
|
225,054
|
PQhostaddr(const PGconn *conn)
{
if (!conn)
return NULL;
/* Return the parsed IP address */
if (conn->connhost != NULL && conn->connip != NULL)
return conn->connip;
return "";
}
| 0
|
348,439
|
static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
int len)
{
unsigned char *ptr = d;
unsigned char c=0;
*ptr++ = END;
while (len > 0) {
if (len > 2)
c = *s++;
else if (len > 1)
c = crc >> 8;
else
c = crc & 0xff;
len--;
switch (c) {
case END:
*ptr++ = ESC;
*ptr++ = ESC_END;
break;
case ESC:
*ptr++ = ESC;
*ptr++ = ESC_ESC;
break;
default:
*ptr++ = c;
break;
}
}
*ptr++ = END;
return ptr - d;
}
| 0
|
385,795
|
unsigned int full_name_hash(const unsigned char *name, unsigned int len)
{
unsigned long a, mask;
unsigned long hash = 0;
for (;;) {
a = load_unaligned_zeropad(name);
if (len < sizeof(unsigned long))
break;
hash += a;
hash *= 9;
name += sizeof(unsigned long);
len -= sizeof(unsigned long);
if (!len)
goto done;
}
mask = ~(~0ul << len*8);
hash += mask & a;
done:
return fold_hash(hash);
}
| 0
|
450,818
|
next_brace_sub (const char *cp, int flags)
{
size_t depth = 0;
while (*cp != '\0')
if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
{
if (*++cp == '\0')
break;
++cp;
}
else
{
if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
break;
if (*cp++ == '{')
depth++;
}
return *cp != '\0' ? cp : NULL;
}
| 0
|
278,258
|
get_indent(void)
{
#ifdef FEAT_VARTABS
return get_indent_str_vtab(ml_get_curline(), (int)curbuf->b_p_ts,
curbuf->b_p_vts_array, FALSE);
#else
return get_indent_str(ml_get_curline(), (int)curbuf->b_p_ts, FALSE);
#endif
}
| 0
|
216,202
|
int sftp_mkdir(sftp_session sftp, const char *directory, mode_t mode) {
sftp_status_message status = NULL;
sftp_message msg = NULL;
sftp_attributes errno_attr = NULL;
struct sftp_attributes_struct attr;
ssh_buffer buffer;
ssh_string path;
uint32_t id;
buffer = ssh_buffer_new();
if (buffer == NULL) {
ssh_set_error_oom(sftp->session);
return -1;
}
path = ssh_string_from_char(directory);
if (path == NULL) {
ssh_set_error_oom(sftp->session);
ssh_buffer_free(buffer);
return -1;
}
ZERO_STRUCT(attr);
attr.permissions = mode;
attr.flags = SSH_FILEXFER_ATTR_PERMISSIONS;
id = sftp_get_new_id(sftp);
if (buffer_add_u32(buffer, id) < 0 ||
buffer_add_ssh_string(buffer, path) < 0 ||
buffer_add_attributes(buffer, &attr) < 0 ||
sftp_packet_write(sftp, SSH_FXP_MKDIR, buffer) < 0) {
ssh_buffer_free(buffer);
ssh_string_free(path);
}
ssh_buffer_free(buffer);
ssh_string_free(path);
while (msg == NULL) {
if (sftp_read_and_dispatch(sftp) < 0) {
return -1;
}
msg = sftp_dequeue(sftp, id);
}
/* By specification, this command only returns SSH_FXP_STATUS */
if (msg->packet_type == SSH_FXP_STATUS) {
status = parse_status_msg(msg);
sftp_message_free(msg);
if (status == NULL) {
return -1;
}
sftp_set_error(sftp, status->status);
switch (status->status) {
case SSH_FX_FAILURE:
/*
* mkdir always returns a failure, even if the path already exists.
* To be POSIX conform and to be able to map it to EEXIST a stat
* call is needed here.
*/
errno_attr = sftp_lstat(sftp, directory);
if (errno_attr != NULL) {
SAFE_FREE(errno_attr);
sftp_set_error(sftp, SSH_FX_FILE_ALREADY_EXISTS);
}
break;
case SSH_FX_OK:
status_msg_free(status);
return 0;
break;
default:
break;
}
/*
* The status should be SSH_FX_OK if the command was successful, if it
* didn't, then there was an error
*/
ssh_set_error(sftp->session, SSH_REQUEST_DENIED,
"SFTP server: %s", status->errormsg);
status_msg_free(status);
return -1;
} else {
ssh_set_error(sftp->session, SSH_FATAL,
"Received message %d when attempting to make directory",
msg->packet_type);
sftp_message_free(msg);
}
return -1;
}
| 1
|
430,395
|
static int validate_and_copy_set_tun(const struct nlattr *attr,
struct sw_flow_actions **sfa, bool log)
{
struct sw_flow_match match;
struct sw_flow_key key;
struct metadata_dst *tun_dst;
struct ip_tunnel_info *tun_info;
struct ovs_tunnel_info *ovs_tun;
struct nlattr *a;
int err = 0, start, opts_type;
__be16 dst_opt_type;
dst_opt_type = 0;
ovs_match_init(&match, &key, true, NULL);
opts_type = ip_tun_from_nlattr(nla_data(attr), &match, false, log);
if (opts_type < 0)
return opts_type;
if (key.tun_opts_len) {
switch (opts_type) {
case OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS:
err = validate_geneve_opts(&key);
if (err < 0)
return err;
dst_opt_type = TUNNEL_GENEVE_OPT;
break;
case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS:
dst_opt_type = TUNNEL_VXLAN_OPT;
break;
case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS:
dst_opt_type = TUNNEL_ERSPAN_OPT;
break;
}
}
start = add_nested_action_start(sfa, OVS_ACTION_ATTR_SET, log);
if (start < 0)
return start;
tun_dst = metadata_dst_alloc(key.tun_opts_len, METADATA_IP_TUNNEL,
GFP_KERNEL);
if (!tun_dst)
return -ENOMEM;
err = dst_cache_init(&tun_dst->u.tun_info.dst_cache, GFP_KERNEL);
if (err) {
dst_release((struct dst_entry *)tun_dst);
return err;
}
a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL,
sizeof(*ovs_tun), log);
if (IS_ERR(a)) {
dst_release((struct dst_entry *)tun_dst);
return PTR_ERR(a);
}
ovs_tun = nla_data(a);
ovs_tun->tun_dst = tun_dst;
tun_info = &tun_dst->u.tun_info;
tun_info->mode = IP_TUNNEL_INFO_TX;
if (key.tun_proto == AF_INET6)
tun_info->mode |= IP_TUNNEL_INFO_IPV6;
else if (key.tun_proto == AF_INET && key.tun_key.u.ipv4.dst == 0)
tun_info->mode |= IP_TUNNEL_INFO_BRIDGE;
tun_info->key = key.tun_key;
/* We need to store the options in the action itself since
* everything else will go away after flow setup. We can append
* it to tun_info and then point there.
*/
ip_tunnel_info_opts_set(tun_info,
TUN_METADATA_OPTS(&key, key.tun_opts_len),
key.tun_opts_len, dst_opt_type);
add_nested_action_end(*sfa, start);
return err;
}
| 0
|
234,752
|
static void warn_32bit_meta_chunk(struct btrfs_fs_info *fs_info,
u64 logical, u64 length, u64 type)
{
if (!(type & BTRFS_BLOCK_GROUP_METADATA))
return;
if (logical + length < BTRFS_32BIT_EARLY_WARN_THRESHOLD)
return;
btrfs_warn_32bit_limit(fs_info);
}
| 0
|
225,450
|
static inline void v4l2l_get_timestamp(struct v4l2_buffer *b)
{
/* ktime_get_ts is considered deprecated, so use ktime_get_ts64 if possible */
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
struct timespec ts;
ktime_get_ts(&ts);
#else
struct timespec64 ts;
ktime_get_ts64(&ts);
#endif
b->timestamp.tv_sec = ts.tv_sec;
b->timestamp.tv_usec = (ts.tv_nsec / NSEC_PER_USEC);
}
| 0
|
220,218
|
void Node::set_original_node_names(const std::vector<std::string>& names) {
MaybeCopyOnWrite();
props_->node_def.mutable_experimental_debug_info()
->clear_original_node_names();
if (!names.empty()) {
*props_->node_def.mutable_experimental_debug_info()
->mutable_original_node_names() = {names.begin(), names.end()};
}
}
| 0
|
226,108
|
GF_Box *tref_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TrackReferenceBox, GF_ISOM_BOX_TYPE_TREF);
return (GF_Box *)tmp;
| 0
|
211,471
|
static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt,
bgp_size_t length)
{
uint8_t *end;
struct capability_mp_data mpc;
struct capability_header *hdr;
uint8_t action;
iana_afi_t pkt_afi;
afi_t afi;
iana_safi_t pkt_safi;
safi_t safi;
end = pnt + length;
while (pnt < end) {
/* We need at least action, capability code and capability
* length. */
if (pnt + 3 > end) {
zlog_info("%s Capability length error", peer->host);
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
action = *pnt;
hdr = (struct capability_header *)(pnt + 1);
/* Action value check. */
if (action != CAPABILITY_ACTION_SET
&& action != CAPABILITY_ACTION_UNSET) {
zlog_info("%s Capability Action Value error %d",
peer->host, action);
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%s CAPABILITY has action: %d, code: %u, length %u",
peer->host, action, hdr->code, hdr->length);
/* Capability length check. */
if ((pnt + hdr->length + 3) > end) {
zlog_info("%s Capability length error", peer->host);
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_SUBCODE_UNSPECIFIC);
return BGP_Stop;
}
/* Fetch structure to the byte stream. */
memcpy(&mpc, pnt + 3, sizeof(struct capability_mp_data));
pnt += hdr->length + 3;
/* We know MP Capability Code. */
if (hdr->code == CAPABILITY_CODE_MP) {
pkt_afi = ntohs(mpc.afi);
pkt_safi = mpc.safi;
/* Ignore capability when override-capability is set. */
if (CHECK_FLAG(peer->flags,
PEER_FLAG_OVERRIDE_CAPABILITY))
continue;
/* Convert AFI, SAFI to internal values. */
if (bgp_map_afi_safi_iana2int(pkt_afi, pkt_safi, &afi,
&safi)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%s Dynamic Capability MP_EXT afi/safi invalid (%s/%s)",
peer->host,
iana_afi2str(pkt_afi),
iana_safi2str(pkt_safi));
continue;
}
/* Address family check. */
if (bgp_debug_neighbor_events(peer))
zlog_debug(
"%s CAPABILITY has %s MP_EXT CAP for afi/safi: %s/%s",
peer->host,
action == CAPABILITY_ACTION_SET
? "Advertising"
: "Removing",
iana_afi2str(pkt_afi),
iana_safi2str(pkt_safi));
if (action == CAPABILITY_ACTION_SET) {
peer->afc_recv[afi][safi] = 1;
if (peer->afc[afi][safi]) {
peer->afc_nego[afi][safi] = 1;
bgp_announce_route(peer, afi, safi,
false);
}
} else {
peer->afc_recv[afi][safi] = 0;
peer->afc_nego[afi][safi] = 0;
if (peer_active_nego(peer))
bgp_clear_route(peer, afi, safi);
else
return BGP_Stop;
}
} else {
flog_warn(
EC_BGP_UNRECOGNIZED_CAPABILITY,
"%s unrecognized capability code: %d - ignored",
peer->host, hdr->code);
}
}
/* No FSM action necessary */
return BGP_PACKET_NOOP;
}
| 1
|
448,930
|
void arch_pick_mmap_layout(struct mm_struct *mm)
{
/*
* Fall back to the standard layout if the personality bit is set, or
* if the expected stack growth is unlimited:
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
mm->get_unmapped_area = arch_get_unmapped_area;
} else {
mm->mmap_base = mmap_base();
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
}
}
| 0
|
206,273
|
static void extract_arg(RAnal *anal, RAnalFunction *fcn, RAnalOp *op, const char *reg, const char *sign, char type) {
st64 ptr = 0;
char *addr, *esil_buf = NULL;
const st64 maxstackframe = 1024 * 8;
r_return_if_fail (anal && fcn && op && reg);
size_t i;
for (i = 0; i < R_ARRAY_SIZE (op->src); i++) {
if (op->src[i] && op->src[i]->reg && op->src[i]->reg->name) {
if (!strcmp (reg, op->src[i]->reg->name)) {
st64 delta = op->src[i]->delta;
if ((delta > 0 && *sign == '+') || (delta < 0 && *sign == '-')) {
ptr = R_ABS (op->src[i]->delta);
break;
}
}
}
}
if (!ptr) {
const char *op_esil = r_strbuf_get (&op->esil);
if (!op_esil) {
return;
}
esil_buf = strdup (op_esil);
if (!esil_buf) {
return;
}
r_strf_var (esilexpr, 64, ",%s,%s,", reg, sign);
char *ptr_end = strstr (esil_buf, esilexpr);
if (!ptr_end) {
free (esil_buf);
return;
}
*ptr_end = 0;
addr = ptr_end;
while ((addr[0] != '0' || addr[1] != 'x') && addr >= esil_buf + 1 && *addr != ',') {
addr--;
}
if (strncmp (addr, "0x", 2)) {
//XXX: This is a workaround for inconsistent esil
if (!op->stackop && op->dst) {
const char *sp = r_reg_get_name (anal->reg, R_REG_NAME_SP);
const char *bp = r_reg_get_name (anal->reg, R_REG_NAME_BP);
const char *rn = op->dst->reg ? op->dst->reg->name : NULL;
if (rn && ((bp && !strcmp (bp, rn)) || (sp && !strcmp (sp, rn)))) {
if (anal->verbose) {
eprintf ("Warning: Analysis didn't fill op->stackop for instruction that alters stack at 0x%" PFMT64x ".\n", op->addr);
}
goto beach;
}
}
if (*addr == ',') {
addr++;
}
if (!op->stackop && op->type != R_ANAL_OP_TYPE_PUSH && op->type != R_ANAL_OP_TYPE_POP
&& op->type != R_ANAL_OP_TYPE_RET && r_str_isnumber (addr)) {
ptr = (st64)r_num_get (NULL, addr);
if (ptr && op->src[0] && ptr == op->src[0]->imm) {
goto beach;
}
} else if ((op->stackop == R_ANAL_STACK_SET) || (op->stackop == R_ANAL_STACK_GET)) {
if (op->ptr % 4) {
goto beach;
}
ptr = R_ABS (op->ptr);
} else {
goto beach;
}
} else {
ptr = (st64)r_num_get (NULL, addr);
}
}
if (anal->verbose && (!op->src[0] || !op->dst)) {
eprintf ("Warning: Analysis didn't fill op->src/dst at 0x%" PFMT64x ".\n", op->addr);
}
int rw = (op->direction == R_ANAL_OP_DIR_WRITE) ? R_ANAL_VAR_ACCESS_TYPE_WRITE : R_ANAL_VAR_ACCESS_TYPE_READ;
if (*sign == '+') {
const bool isarg = type == R_ANAL_VAR_KIND_SPV ? ptr >= fcn->stack : ptr >= fcn->bp_off;
const char *pfx = isarg ? ARGPREFIX : VARPREFIX;
st64 frame_off;
if (type == R_ANAL_VAR_KIND_SPV) {
frame_off = ptr - fcn->stack;
} else {
frame_off = ptr - fcn->bp_off;
}
if (maxstackframe != 0 && (frame_off > maxstackframe || frame_off < -maxstackframe)) {
goto beach;
}
RAnalVar *var = get_stack_var (fcn, frame_off);
if (var) {
r_anal_var_set_access (var, reg, op->addr, rw, ptr);
goto beach;
}
char *varname = NULL, *vartype = NULL;
if (isarg) {
const char *place = fcn->cc ? r_anal_cc_arg (anal, fcn->cc, ST32_MAX) : NULL;
bool stack_rev = place ? !strcmp (place, "stack_rev") : false;
char *fname = r_type_func_guess (anal->sdb_types, fcn->name);
if (fname) {
ut64 sum_sz = 0;
size_t from, to, i;
if (stack_rev) {
const size_t cnt = r_type_func_args_count (anal->sdb_types, fname);
from = cnt ? cnt - 1 : cnt;
to = fcn->cc ? r_anal_cc_max_arg (anal, fcn->cc) : 0;
} else {
from = fcn->cc ? r_anal_cc_max_arg (anal, fcn->cc) : 0;
to = r_type_func_args_count (anal->sdb_types, fname);
}
const int bytes = (fcn->bits ? fcn->bits : anal->bits) / 8;
for (i = from; stack_rev ? i >= to : i < to; stack_rev ? i-- : i++) {
char *tp = r_type_func_args_type (anal->sdb_types, fname, i);
if (!tp) {
break;
}
if (sum_sz == frame_off) {
vartype = tp;
varname = strdup (r_type_func_args_name (anal->sdb_types, fname, i));
break;
}
ut64 bit_sz = r_type_get_bitsize (anal->sdb_types, tp);
sum_sz += bit_sz ? bit_sz / 8 : bytes;
sum_sz = R_ROUND (sum_sz, bytes);
free (tp);
}
free (fname);
}
}
if (!varname) {
if (anal->opt.varname_stack) {
varname = r_str_newf ("%s_%" PFMT64x "h", pfx, R_ABS (frame_off));
} else {
varname = r_anal_function_autoname_var (fcn, type, pfx, ptr);
}
}
if (varname) {
#if 0
if (isarg && frame_off > 48) {
free (varname);
goto beach;
}
#endif
RAnalVar *var = r_anal_function_set_var (fcn, frame_off, type, vartype, anal->bits / 8, isarg, varname);
if (var) {
r_anal_var_set_access (var, reg, op->addr, rw, ptr);
}
free (varname);
}
free (vartype);
} else {
st64 frame_off = -(ptr + fcn->bp_off);
if (maxstackframe != 0 && (frame_off > maxstackframe || frame_off < -maxstackframe)) {
goto beach;
}
RAnalVar *var = get_stack_var (fcn, frame_off);
if (var) {
r_anal_var_set_access (var, reg, op->addr, rw, -ptr);
goto beach;
}
char *varname = anal->opt.varname_stack
? r_str_newf ("%s_%" PFMT64x "h", VARPREFIX, R_ABS (frame_off))
: r_anal_function_autoname_var (fcn, type, VARPREFIX, -ptr);
if (varname) {
RAnalVar *var = r_anal_function_set_var (fcn, frame_off, type, NULL, anal->bits / 8, false, varname);
if (var) {
r_anal_var_set_access (var, reg, op->addr, rw, -ptr);
}
free (varname);
}
}
beach:
free (esil_buf);
}
| 1
|
508,340
|
static my_bool list_open_tables_callback(TDC_element *element,
list_open_tables_arg *arg)
{
char *db= (char*) element->m_key;
char *table_name= (char*) element->m_key + strlen((char*) element->m_key) + 1;
if (arg->db && my_strcasecmp(system_charset_info, arg->db, db))
return FALSE;
if (arg->wild && wild_compare(table_name, arg->wild, 0))
return FALSE;
/* Check if user has SELECT privilege for any column in the table */
arg->table_list.db= db;
arg->table_list.table_name= table_name;
arg->table_list.grant.privilege= 0;
if (check_table_access(arg->thd, SELECT_ACL, &arg->table_list, TRUE, 1, TRUE))
return FALSE;
if (!(*arg->start_list= (OPEN_TABLE_LIST *) arg->thd->alloc(
sizeof(**arg->start_list) + element->m_key_length)))
return TRUE;
strmov((*arg->start_list)->table=
strmov(((*arg->start_list)->db= (char*) ((*arg->start_list) + 1)),
db) + 1, table_name);
(*arg->start_list)->in_use= 0;
mysql_mutex_lock(&element->LOCK_table_share);
All_share_tables_list::Iterator it(element->all_tables);
TABLE *table;
while ((table= it++))
if (table->in_use)
++(*arg->start_list)->in_use;
mysql_mutex_unlock(&element->LOCK_table_share);
(*arg->start_list)->locked= 0; /* Obsolete. */
arg->start_list= &(*arg->start_list)->next;
*arg->start_list= 0;
return FALSE;
}
| 0
|
310,260
|
dirserv_thinks_router_is_unreliable(time_t now,
routerinfo_t *router,
int need_uptime, int need_capacity)
{
if (need_uptime) {
if (!enough_mtbf_info) {
/* XXX023 Once most authorities are on v3, we should change the rule from
* "use uptime if we don't have mtbf data" to "don't advertise Stable on
* v3 if we don't have enough mtbf data." Or maybe not, since if we ever
* hit a point where we need to reset a lot of authorities at once,
* none of them would be in a position to declare Stable.
*/
long uptime = real_uptime(router, now);
if ((unsigned)uptime < stable_uptime &&
(unsigned)uptime < UPTIME_TO_GUARANTEE_STABLE)
return 1;
} else {
double mtbf =
rep_hist_get_stability(router->cache_info.identity_digest, now);
if (mtbf < stable_mtbf &&
mtbf < MTBF_TO_GUARANTEE_STABLE)
return 1;
}
}
if (need_capacity) {
uint32_t bw = router_get_advertised_bandwidth(router);
if (bw < fast_bandwidth)
return 1;
}
return 0;
}
| 0
|
413,660
|
static ut64 delta_for_access(RAnalOp *op, RAnalVarAccessType type) {
if (type == R_ANAL_VAR_ACCESS_TYPE_WRITE) {
if (op->dst) {
return op->dst->imm + op->dst->delta;
}
} else {
if (op->src[1] && (op->src[1]->imm || op->src[1]->delta)) {
return op->src[1]->imm + op->src[1]->delta;
}
if (op->src[0]) {
return op->src[0]->imm + op->src[0]->delta;
}
}
return 0;
}
| 0
|
219,978
|
int callback_glewlwyd_get_plugin_module (const struct _u_request * request, struct _u_response * response, void * plugin_data) {
struct config_elements * config = (struct config_elements *)plugin_data;
json_t * j_module;
j_module = get_plugin_module(config, u_map_get(request->map_url, "name"));
if (check_result_value(j_module, G_OK)) {
ulfius_set_json_body_response(response, 200, json_object_get(j_module, "module"));
} else if (check_result_value(j_module, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_get_plugin_module - Error get_plugin_module");
response->status = 500;
}
json_decref(j_module);
return U_CALLBACK_CONTINUE;
}
| 0
|
210,527
|
static netdev_tx_t mcba_usb_start_xmit(struct sk_buff *skb,
struct net_device *netdev)
{
struct mcba_priv *priv = netdev_priv(netdev);
struct can_frame *cf = (struct can_frame *)skb->data;
struct mcba_usb_ctx *ctx = NULL;
struct net_device_stats *stats = &priv->netdev->stats;
u16 sid;
int err;
struct mcba_usb_msg_can usb_msg = {
.cmd_id = MBCA_CMD_TRANSMIT_MESSAGE_EV
};
if (can_dropped_invalid_skb(netdev, skb))
return NETDEV_TX_OK;
ctx = mcba_usb_get_free_ctx(priv, cf);
if (!ctx)
return NETDEV_TX_BUSY;
if (cf->can_id & CAN_EFF_FLAG) {
/* SIDH | SIDL | EIDH | EIDL
* 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0
*/
sid = MCBA_SIDL_EXID_MASK;
/* store 28-18 bits */
sid |= (cf->can_id & 0x1ffc0000) >> 13;
/* store 17-16 bits */
sid |= (cf->can_id & 0x30000) >> 16;
put_unaligned_be16(sid, &usb_msg.sid);
/* store 15-0 bits */
put_unaligned_be16(cf->can_id & 0xffff, &usb_msg.eid);
} else {
/* SIDH | SIDL
* 10 - 3 | 2 1 0 x x x x x
*/
put_unaligned_be16((cf->can_id & CAN_SFF_MASK) << 5,
&usb_msg.sid);
usb_msg.eid = 0;
}
usb_msg.dlc = cf->len;
memcpy(usb_msg.data, cf->data, usb_msg.dlc);
if (cf->can_id & CAN_RTR_FLAG)
usb_msg.dlc |= MCBA_DLC_RTR_MASK;
can_put_echo_skb(skb, priv->netdev, ctx->ndx, 0);
err = mcba_usb_xmit(priv, (struct mcba_usb_msg *)&usb_msg, ctx);
if (err)
goto xmit_failed;
return NETDEV_TX_OK;
xmit_failed:
can_free_echo_skb(priv->netdev, ctx->ndx, NULL);
mcba_usb_free_ctx(ctx);
dev_kfree_skb(skb);
stats->tx_dropped++;
return NETDEV_TX_OK;
}
| 1
|
513,131
|
static int check_func_str(THD *thd, struct st_mysql_sys_var *var,
void *save, st_mysql_value *value)
{
char buff[STRING_BUFFER_USUAL_SIZE];
const char *str;
int length;
length= sizeof(buff);
if ((str= value->val_str(value, buff, &length)))
str= thd->strmake(str, length);
*(const char**)save= str;
return 0;
}
| 0
|
508,403
|
bool restart_trans_for_tables(THD *thd, TABLE_LIST *table)
{
DBUG_ENTER("restart_trans_for_tables");
for (; table; table= table->next_global)
{
if (table->placeholder())
continue;
if (check_lock_and_start_stmt(thd, thd->lex, table))
{
DBUG_ASSERT(0); // Should never happen
DBUG_RETURN(TRUE);
}
}
DBUG_RETURN(FALSE);
}
| 0
|
247,599
|
TEST_P(SslSocketTest, ClientCertificateHashAndSpkiVerification) {
envoy::config::listener::v3::Listener listener;
envoy::config::listener::v3::FilterChain* filter_chain = listener.add_filter_chains();
envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context;
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* server_cert =
tls_context.mutable_common_tls_context()->add_tls_certificates();
server_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem"));
server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_key.pem"));
envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext*
server_validation_ctx =
tls_context.mutable_common_tls_context()->mutable_validation_context();
server_validation_ctx->mutable_trusted_ca()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"));
server_validation_ctx->add_verify_certificate_hash(
"0000000000000000000000000000000000000000000000000000000000000000");
server_validation_ctx->add_verify_certificate_spki(TEST_SAN_DNS_CERT_SPKI);
server_validation_ctx->add_verify_certificate_spki(TEST_SAN_URI_CERT_SPKI);
updateFilterChain(tls_context, *filter_chain);
envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client;
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert =
client.mutable_common_tls_context()->add_tls_certificates();
client_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"));
client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"));
TestUtilOptionsV2 test_options(listener, client, true, GetParam());
testUtilV2(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team")
.setExpectedServerCertDigest(TEST_SAN_DNS_CERT_256_HASH));
// Works even with client renegotiation.
client.set_allow_renegotiation(true);
testUtilV2(test_options);
}
| 0
|
292,133
|
void LinkResolver::resolve_invokehandle(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
// This guy is reached from InterpreterRuntime::resolve_invokehandle.
LinkInfo link_info(pool, index, CHECK);
if (TraceMethodHandles) {
ResourceMark rm(THREAD);
tty->print_cr("resolve_invokehandle %s %s", link_info.name()->as_C_string(),
link_info.signature()->as_C_string());
}
resolve_handle_call(result, link_info, CHECK);
}
| 0
|
503,985
|
auth_request_get_var_expand_table_full(const struct auth_request *auth_request,
auth_request_escape_func_t *escape_func,
unsigned int *count)
{
const unsigned int auth_count =
N_ELEMENTS(auth_request_var_expand_static_tab);
struct var_expand_table *tab, *ret_tab;
const char *orig_user, *auth_user, *username;
if (escape_func == NULL)
escape_func = escape_none;
/* keep the extra fields at the beginning. the last static_tab field
contains the ending NULL-fields. */
tab = ret_tab = t_malloc((*count + auth_count) * sizeof(*tab));
memset(tab, 0, *count * sizeof(*tab));
tab += *count;
*count += auth_count;
memcpy(tab, auth_request_var_expand_static_tab,
auth_count * sizeof(*tab));
username = auth_request->user != NULL ? auth_request->user : "";
tab[0].value = escape_func(username, auth_request);
tab[1].value = escape_func(t_strcut(username, '@'),
auth_request);
tab[2].value = strchr(username, '@');
if (tab[2].value != NULL)
tab[2].value = escape_func(tab[2].value+1, auth_request);
tab[3].value = escape_func(auth_request->service, auth_request);
/* tab[4] = we have no home dir */
if (auth_request->local_ip.family != 0)
tab[5].value = net_ip2addr(&auth_request->local_ip);
if (auth_request->remote_ip.family != 0)
tab[6].value = net_ip2addr(&auth_request->remote_ip);
tab[7].value = dec2str(auth_request->client_pid);
if (auth_request->mech_password != NULL) {
tab[8].value = escape_func(auth_request->mech_password,
auth_request);
}
if (auth_request->userdb_lookup) {
tab[9].value = auth_request->userdb == NULL ? "" :
dec2str(auth_request->userdb->userdb->id);
} else {
tab[9].value = auth_request->passdb == NULL ? "" :
dec2str(auth_request->passdb->passdb->id);
}
tab[10].value = auth_request->mech_name == NULL ? "" :
escape_func(auth_request->mech_name, auth_request);
tab[11].value = auth_request->secured ? "secured" : "";
tab[12].value = dec2str(auth_request->local_port);
tab[13].value = dec2str(auth_request->remote_port);
tab[14].value = auth_request->valid_client_cert ? "valid" : "";
if (auth_request->requested_login_user != NULL) {
const char *login_user = auth_request->requested_login_user;
tab[15].value = escape_func(login_user, auth_request);
tab[16].value = escape_func(t_strcut(login_user, '@'),
auth_request);
tab[17].value = strchr(login_user, '@');
if (tab[17].value != NULL) {
tab[17].value = escape_func(tab[17].value+1,
auth_request);
}
}
tab[18].value = auth_request->session_id == NULL ? NULL :
escape_func(auth_request->session_id, auth_request);
if (auth_request->real_local_ip.family != 0)
tab[19].value = net_ip2addr(&auth_request->real_local_ip);
if (auth_request->real_remote_ip.family != 0)
tab[20].value = net_ip2addr(&auth_request->real_remote_ip);
tab[21].value = dec2str(auth_request->real_local_port);
tab[22].value = dec2str(auth_request->real_remote_port);
tab[23].value = strchr(username, '@');
if (tab[23].value != NULL) {
tab[23].value = escape_func(t_strcut(tab[23].value+1, '@'),
auth_request);
}
tab[24].value = strrchr(username, '@');
if (tab[24].value != NULL)
tab[24].value = escape_func(tab[24].value+1, auth_request);
tab[25].value = auth_request->master_user == NULL ? NULL :
escape_func(auth_request->master_user, auth_request);
tab[26].value = auth_request->session_pid == (pid_t)-1 ? NULL :
dec2str(auth_request->session_pid);
orig_user = auth_request->original_username != NULL ?
auth_request->original_username : username;
tab[27].value = escape_func(orig_user, auth_request);
tab[28].value = escape_func(t_strcut(orig_user, '@'), auth_request);
tab[29].value = strchr(orig_user, '@');
if (tab[29].value != NULL)
tab[29].value = escape_func(tab[29].value+1, auth_request);
if (auth_request->master_user != NULL)
auth_user = auth_request->master_user;
else
auth_user = orig_user;
tab[30].value = escape_func(auth_user, auth_request);
tab[31].value = escape_func(t_strcut(auth_user, '@'), auth_request);
tab[32].value = strchr(auth_user, '@');
if (tab[32].value != NULL)
tab[32].value = escape_func(tab[32].value+1, auth_request);
if (auth_request->local_name != NULL)
tab[33].value = escape_func(auth_request->local_name, auth_request);
else
tab[33].value = "";
return ret_tab;
}
| 0
|
317,023
|
static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry)
{
struct superblock_security_struct *sbsec = NULL;
struct inode_security_struct *isec = selinux_inode(inode);
u32 task_sid, sid = 0;
u16 sclass;
struct dentry *dentry;
int rc = 0;
if (isec->initialized == LABEL_INITIALIZED)
return 0;
spin_lock(&isec->lock);
if (isec->initialized == LABEL_INITIALIZED)
goto out_unlock;
if (isec->sclass == SECCLASS_FILE)
isec->sclass = inode_mode_to_security_class(inode->i_mode);
sbsec = selinux_superblock(inode->i_sb);
if (!(sbsec->flags & SE_SBINITIALIZED)) {
/* Defer initialization until selinux_complete_init,
after the initial policy is loaded and the security
server is ready to handle calls. */
spin_lock(&sbsec->isec_lock);
if (list_empty(&isec->list))
list_add(&isec->list, &sbsec->isec_head);
spin_unlock(&sbsec->isec_lock);
goto out_unlock;
}
sclass = isec->sclass;
task_sid = isec->task_sid;
sid = isec->sid;
isec->initialized = LABEL_PENDING;
spin_unlock(&isec->lock);
switch (sbsec->behavior) {
case SECURITY_FS_USE_NATIVE:
break;
case SECURITY_FS_USE_XATTR:
if (!(inode->i_opflags & IOP_XATTR)) {
sid = sbsec->def_sid;
break;
}
/* Need a dentry, since the xattr API requires one.
Life would be simpler if we could just pass the inode. */
if (opt_dentry) {
/* Called from d_instantiate or d_splice_alias. */
dentry = dget(opt_dentry);
} else {
/*
* Called from selinux_complete_init, try to find a dentry.
* Some filesystems really want a connected one, so try
* that first. We could split SECURITY_FS_USE_XATTR in
* two, depending upon that...
*/
dentry = d_find_alias(inode);
if (!dentry)
dentry = d_find_any_alias(inode);
}
if (!dentry) {
/*
* this is can be hit on boot when a file is accessed
* before the policy is loaded. When we load policy we
* may find inodes that have no dentry on the
* sbsec->isec_head list. No reason to complain as these
* will get fixed up the next time we go through
* inode_doinit with a dentry, before these inodes could
* be used again by userspace.
*/
goto out_invalid;
}
rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid,
&sid);
dput(dentry);
if (rc)
goto out;
break;
case SECURITY_FS_USE_TASK:
sid = task_sid;
break;
case SECURITY_FS_USE_TRANS:
/* Default to the fs SID. */
sid = sbsec->sid;
/* Try to obtain a transition SID. */
rc = security_transition_sid(&selinux_state, task_sid, sid,
sclass, NULL, &sid);
if (rc)
goto out;
break;
case SECURITY_FS_USE_MNTPOINT:
sid = sbsec->mntpoint_sid;
break;
default:
/* Default to the fs superblock SID. */
sid = sbsec->sid;
if ((sbsec->flags & SE_SBGENFS) &&
(!S_ISLNK(inode->i_mode) ||
selinux_policycap_genfs_seclabel_symlinks())) {
/* We must have a dentry to determine the label on
* procfs inodes */
if (opt_dentry) {
/* Called from d_instantiate or
* d_splice_alias. */
dentry = dget(opt_dentry);
} else {
/* Called from selinux_complete_init, try to
* find a dentry. Some filesystems really want
* a connected one, so try that first.
*/
dentry = d_find_alias(inode);
if (!dentry)
dentry = d_find_any_alias(inode);
}
/*
* This can be hit on boot when a file is accessed
* before the policy is loaded. When we load policy we
* may find inodes that have no dentry on the
* sbsec->isec_head list. No reason to complain as
* these will get fixed up the next time we go through
* inode_doinit() with a dentry, before these inodes
* could be used again by userspace.
*/
if (!dentry)
goto out_invalid;
rc = selinux_genfs_get_sid(dentry, sclass,
sbsec->flags, &sid);
if (rc) {
dput(dentry);
goto out;
}
if ((sbsec->flags & SE_SBGENFS_XATTR) &&
(inode->i_opflags & IOP_XATTR)) {
rc = inode_doinit_use_xattr(inode, dentry,
sid, &sid);
if (rc) {
dput(dentry);
goto out;
}
}
dput(dentry);
}
break;
}
out:
spin_lock(&isec->lock);
if (isec->initialized == LABEL_PENDING) {
if (rc) {
isec->initialized = LABEL_INVALID;
goto out_unlock;
}
isec->initialized = LABEL_INITIALIZED;
isec->sid = sid;
}
out_unlock:
spin_unlock(&isec->lock);
return rc;
out_invalid:
spin_lock(&isec->lock);
if (isec->initialized == LABEL_PENDING) {
isec->initialized = LABEL_INVALID;
isec->sid = sid;
}
spin_unlock(&isec->lock);
return 0;
}
| 0
|
220,825
|
inline std::int32_t SaturatingAddNonGemmlowp(std::int32_t a, std::int32_t b) {
std::int64_t a64 = a;
std::int64_t b64 = b;
std::int64_t sum = a64 + b64;
return static_cast<std::int32_t>(std::min(
static_cast<std::int64_t>(std::numeric_limits<std::int32_t>::max()),
std::max(
static_cast<std::int64_t>(std::numeric_limits<std::int32_t>::min()),
sum)));
}
| 0
|
359,621
|
DEFUN (clear_ip_bgp_as_soft_out,
clear_ip_bgp_as_soft_out_cmd,
"clear ip bgp <1-65535> soft out",
CLEAR_STR
IP_STR
BGP_STR
"Clear peers with the AS number\n"
"Soft reconfig\n"
"Soft reconfig outbound update\n")
{
return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
BGP_CLEAR_SOFT_OUT, argv[0]);
}
| 0
|
227,000
|
IRC_PROTOCOL_CALLBACK(330_343)
{
struct t_irc_channel *ptr_channel;
struct t_gui_buffer *ptr_buffer;
IRC_PROTOCOL_MIN_ARGS(5);
if (argc >= 6)
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, argv[3], command, "whois", NULL),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s[%s%s%s] %s%s %s%s",
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, argv[3]),
argv[3],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5],
irc_nick_color_for_msg (server, 1, NULL, argv[4]),
argv[4]);
}
else
{
ptr_channel = (irc_channel_is_channel (server, argv[3])) ?
irc_channel_search (server, argv[3]) : NULL;
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, argv[3], command, "whois", ptr_buffer),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s[%s%s%s] %s%s",
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, argv[3]),
argv[3],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
(argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]);
}
return WEECHAT_RC_OK;
}
| 0
|
204,544
|
static int em28xx_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev;
struct em28xx *dev = NULL;
int retval;
bool has_vendor_audio = false, has_video = false, has_dvb = false;
int i, nr, try_bulk;
const int ifnum = intf->altsetting[0].desc.bInterfaceNumber;
char *speed;
udev = usb_get_dev(interface_to_usbdev(intf));
/* Check to see next free device and mark as used */
do {
nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
if (nr >= EM28XX_MAXBOARDS) {
/* No free device slots */
dev_err(&intf->dev,
"Driver supports up to %i em28xx boards.\n",
EM28XX_MAXBOARDS);
retval = -ENOMEM;
goto err_no_slot;
}
} while (test_and_set_bit(nr, em28xx_devused));
/* Don't register audio interfaces */
if (intf->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
dev_info(&intf->dev,
"audio device (%04x:%04x): interface %i, class %i\n",
le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct),
ifnum,
intf->altsetting[0].desc.bInterfaceClass);
retval = -ENODEV;
goto err;
}
/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
retval = -ENOMEM;
goto err;
}
/* compute alternate max packet sizes */
dev->alt_max_pkt_size_isoc = kcalloc(intf->num_altsetting,
sizeof(dev->alt_max_pkt_size_isoc[0]),
GFP_KERNEL);
if (!dev->alt_max_pkt_size_isoc) {
kfree(dev);
retval = -ENOMEM;
goto err;
}
/* Get endpoints */
for (i = 0; i < intf->num_altsetting; i++) {
int ep;
for (ep = 0;
ep < intf->altsetting[i].desc.bNumEndpoints;
ep++)
em28xx_check_usb_descriptor(dev, udev, intf,
i, ep,
&has_vendor_audio,
&has_video,
&has_dvb);
}
if (!(has_vendor_audio || has_video || has_dvb)) {
retval = -ENODEV;
goto err_free;
}
switch (udev->speed) {
case USB_SPEED_LOW:
speed = "1.5";
break;
case USB_SPEED_UNKNOWN:
case USB_SPEED_FULL:
speed = "12";
break;
case USB_SPEED_HIGH:
speed = "480";
break;
default:
speed = "unknown";
}
dev_info(&intf->dev,
"New device %s %s @ %s Mbps (%04x:%04x, interface %d, class %d)\n",
udev->manufacturer ? udev->manufacturer : "",
udev->product ? udev->product : "",
speed,
le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct),
ifnum,
intf->altsetting->desc.bInterfaceNumber);
/*
* Make sure we have 480 Mbps of bandwidth, otherwise things like
* video stream wouldn't likely work, since 12 Mbps is generally
* not enough even for most Digital TV streams.
*/
if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
dev_err(&intf->dev, "Device initialization failed.\n");
dev_err(&intf->dev,
"Device must be connected to a high-speed USB 2.0 port.\n");
retval = -ENODEV;
goto err_free;
}
dev->devno = nr;
dev->model = id->driver_info;
dev->alt = -1;
dev->is_audio_only = has_vendor_audio && !(has_video || has_dvb);
dev->has_video = has_video;
dev->ifnum = ifnum;
dev->ts = PRIMARY_TS;
snprintf(dev->name, 28, "em28xx");
dev->dev_next = NULL;
if (has_vendor_audio) {
dev_info(&intf->dev,
"Audio interface %i found (Vendor Class)\n", ifnum);
dev->usb_audio_type = EM28XX_USB_AUDIO_VENDOR;
}
/* Checks if audio is provided by a USB Audio Class intf */
for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
struct usb_interface *uif = udev->config->interface[i];
if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
if (has_vendor_audio)
dev_err(&intf->dev,
"em28xx: device seems to have vendor AND usb audio class interfaces !\n"
"\t\tThe vendor interface will be ignored. Please contact the developers <linux-media@vger.kernel.org>\n");
dev->usb_audio_type = EM28XX_USB_AUDIO_CLASS;
break;
}
}
if (has_video)
dev_info(&intf->dev, "Video interface %i found:%s%s\n",
ifnum,
dev->analog_ep_bulk ? " bulk" : "",
dev->analog_ep_isoc ? " isoc" : "");
if (has_dvb)
dev_info(&intf->dev, "DVB interface %i found:%s%s\n",
ifnum,
dev->dvb_ep_bulk ? " bulk" : "",
dev->dvb_ep_isoc ? " isoc" : "");
dev->num_alt = intf->num_altsetting;
if ((unsigned int)card[nr] < em28xx_bcount)
dev->model = card[nr];
/* save our data pointer in this intf device */
usb_set_intfdata(intf, dev);
/* allocate device struct and check if the device is a webcam */
mutex_init(&dev->lock);
retval = em28xx_init_dev(dev, udev, intf, nr);
if (retval)
goto err_free;
if (usb_xfer_mode < 0) {
if (dev->is_webcam)
try_bulk = 1;
else
try_bulk = 0;
} else {
try_bulk = usb_xfer_mode > 0;
}
/* Disable V4L2 if the device doesn't have a decoder or image sensor */
if (has_video &&
dev->board.decoder == EM28XX_NODECODER &&
dev->em28xx_sensor == EM28XX_NOSENSOR) {
dev_err(&intf->dev,
"Currently, V4L2 is not supported on this model\n");
has_video = false;
dev->has_video = false;
}
if (dev->board.has_dual_ts &&
(dev->tuner_type != TUNER_ABSENT || INPUT(0)->type)) {
/*
* The logic with sets alternate is not ready for dual-tuners
* which analog modes.
*/
dev_err(&intf->dev,
"We currently don't support analog TV or stream capture on dual tuners.\n");
has_video = false;
}
/* Select USB transfer types to use */
if (has_video) {
if (!dev->analog_ep_isoc || (try_bulk && dev->analog_ep_bulk))
dev->analog_xfer_bulk = 1;
dev_info(&intf->dev, "analog set to %s mode.\n",
dev->analog_xfer_bulk ? "bulk" : "isoc");
}
if (has_dvb) {
if (!dev->dvb_ep_isoc || (try_bulk && dev->dvb_ep_bulk))
dev->dvb_xfer_bulk = 1;
dev_info(&intf->dev, "dvb set to %s mode.\n",
dev->dvb_xfer_bulk ? "bulk" : "isoc");
}
if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) {
dev->dev_next->ts = SECONDARY_TS;
dev->dev_next->alt = -1;
dev->dev_next->is_audio_only = has_vendor_audio &&
!(has_video || has_dvb);
dev->dev_next->has_video = false;
dev->dev_next->ifnum = ifnum;
dev->dev_next->model = id->driver_info;
mutex_init(&dev->dev_next->lock);
retval = em28xx_init_dev(dev->dev_next, udev, intf,
dev->dev_next->devno);
if (retval)
goto err_free;
dev->dev_next->board.ir_codes = NULL; /* No IR for 2nd tuner */
dev->dev_next->board.has_ir_i2c = 0; /* No IR for 2nd tuner */
if (usb_xfer_mode < 0) {
if (dev->dev_next->is_webcam)
try_bulk = 1;
else
try_bulk = 0;
} else {
try_bulk = usb_xfer_mode > 0;
}
/* Select USB transfer types to use */
if (has_dvb) {
if (!dev->dvb_ep_isoc_ts2 ||
(try_bulk && dev->dvb_ep_bulk_ts2))
dev->dev_next->dvb_xfer_bulk = 1;
dev_info(&dev->intf->dev, "dvb ts2 set to %s mode.\n",
dev->dev_next->dvb_xfer_bulk ? "bulk" : "isoc");
}
dev->dev_next->dvb_ep_isoc = dev->dvb_ep_isoc_ts2;
dev->dev_next->dvb_ep_bulk = dev->dvb_ep_bulk_ts2;
dev->dev_next->dvb_max_pkt_size_isoc = dev->dvb_max_pkt_size_isoc_ts2;
dev->dev_next->dvb_alt_isoc = dev->dvb_alt_isoc;
/* Configure hardware to support TS2*/
if (dev->dvb_xfer_bulk) {
/* The ep4 and ep5 are configured for BULK */
em28xx_write_reg(dev, 0x0b, 0x96);
mdelay(100);
em28xx_write_reg(dev, 0x0b, 0x80);
mdelay(100);
} else {
/* The ep4 and ep5 are configured for ISO */
em28xx_write_reg(dev, 0x0b, 0x96);
mdelay(100);
em28xx_write_reg(dev, 0x0b, 0x82);
mdelay(100);
}
kref_init(&dev->dev_next->ref);
}
kref_init(&dev->ref);
request_modules(dev);
/*
* Do it at the end, to reduce dynamic configuration changes during
* the device init. Yet, as request_modules() can be async, the
* topology will likely change after the load of the em28xx subdrivers.
*/
#ifdef CONFIG_MEDIA_CONTROLLER
retval = media_device_register(dev->media_dev);
#endif
return 0;
err_free:
kfree(dev->alt_max_pkt_size_isoc);
kfree(dev);
err:
clear_bit(nr, em28xx_devused);
err_no_slot:
usb_put_dev(udev);
return retval;
}
| 1
|
292,152
|
LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, const methodHandle& current_method, TRAPS) {
// resolve klass
_resolved_klass = pool->klass_ref_at(index, CHECK);
// Get name, signature, and static klass
_name = pool->name_ref_at(index);
_signature = pool->signature_ref_at(index);
_tag = pool->tag_ref_at(index);
_current_klass = pool->pool_holder();
_current_method = current_method;
// Coming from the constant pool always checks access
_check_access = true;
}
| 0
|
247,518
|
TEST_P(SslSocketTest, SignatureAlgorithms) {
envoy::config::listener::v3::Listener listener;
envoy::config::listener::v3::FilterChain* filter_chain = listener.add_filter_chains();
envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context;
envoy::extensions::transport_sockets::tls::v3::CertificateValidationContext*
server_validation_ctx =
tls_context.mutable_common_tls_context()->mutable_validation_context();
server_validation_ctx->mutable_trusted_ca()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"));
// Server ECDSA certificate.
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* server_cert =
tls_context.mutable_common_tls_context()->add_tls_certificates();
server_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir "
"}}/test/extensions/transport_sockets/tls/test_data/selfsigned_ecdsa_p256_cert.pem"));
server_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir "
"}}/test/extensions/transport_sockets/tls/test_data/selfsigned_ecdsa_p256_key.pem"));
updateFilterChain(tls_context, *filter_chain);
envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client;
// Client RSA certificate.
envoy::extensions::transport_sockets::tls::v3::TlsCertificate* client_cert =
client.mutable_common_tls_context()->add_tls_certificates();
client_cert->mutable_certificate_chain()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"));
client_cert->mutable_private_key()->set_filename(TestEnvironment::substitute(
"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"));
// Connection using defaults (client & server) succeeds.
TestUtilOptionsV2 algorithm_test_options(listener, client, true, GetParam());
algorithm_test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team")
.setExpectedServerStats("ssl.sigalgs.rsa_pss_rsae_sha256")
.setExpectedClientStats("ssl.sigalgs.ecdsa_secp256r1_sha256");
testUtilV2(algorithm_test_options);
// Connection using defaults (client & server) succeeds, even with client renegotiation.
client.set_allow_renegotiation(true);
testUtilV2(algorithm_test_options);
client.set_allow_renegotiation(false);
}
| 0
|
226,044
|
GF_Err pmax_box_size(GF_Box *s)
{
s->size += 4;
return GF_OK;
}
| 0
|
252,423
|
static MZ_FORCEINLINE const mz_uint8 *mz_zip_reader_get_cdh(
mz_zip_archive *pZip, mz_uint file_index) {
if ((!pZip) || (!pZip->m_pState) || (file_index >= pZip->m_total_files) ||
(pZip->m_zip_mode != MZ_ZIP_MODE_READING))
return NULL;
return &MZ_ZIP_ARRAY_ELEMENT(
&pZip->m_pState->m_central_dir, mz_uint8,
MZ_ZIP_ARRAY_ELEMENT(&pZip->m_pState->m_central_dir_offsets, mz_uint32,
file_index));
}
| 0
|
212,934
|
static int write_entry(struct mailbox *mailbox,
unsigned int uid,
const char *entry,
const char *userid,
const struct buf *value,
int ignorequota,
int silent,
const struct annotate_metadata *mdata,
int maywrite)
{
char key[MAX_MAILBOX_PATH+1];
int keylen, r;
annotate_db_t *d = NULL;
struct buf oldval = BUF_INITIALIZER;
const char *mboxname = mailbox ? mailbox->name : "";
modseq_t modseq = mdata ? mdata->modseq : 0;
r = _annotate_getdb(mboxname, uid, CYRUSDB_CREATE, &d);
if (r)
return r;
/* must be in a transaction to modify the db */
annotate_begin(d);
keylen = make_key(mboxname, uid, entry, userid, key, sizeof(key));
if (mailbox) {
struct annotate_metadata oldmdata;
r = read_old_value(d, key, keylen, &oldval, &oldmdata);
if (r) goto out;
/* if the value is identical, don't touch the mailbox */
if (oldval.len == value->len && (!value->len || !memcmp(oldval.s, value->s, value->len)))
goto out;
if (!ignorequota) {
quota_t qdiffs[QUOTA_NUMRESOURCES] = QUOTA_DIFFS_DONTCARE_INITIALIZER;
qdiffs[QUOTA_ANNOTSTORAGE] = value->len - (quota_t)oldval.len;
r = mailbox_quota_check(mailbox, qdiffs);
if (r) goto out;
}
if (!maywrite) {
r = IMAP_PERMISSION_DENIED;
if (r) goto out;
}
/* do the annot-changed here before altering the DB */
mailbox_annot_changed(mailbox, uid, entry, userid, &oldval, value, silent);
/* grab the message annotation modseq, if not overridden */
if (uid && !mdata) {
modseq = mailbox->i.highestmodseq;
}
}
/* zero length annotation is deletion.
* keep tombstones for message annotations */
if (!value->len && !uid) {
#if DEBUG
syslog(LOG_ERR, "write_entry: deleting key %s from %s",
key_as_string(d, key, keylen), d->filename);
#endif
do {
r = cyrusdb_delete(d->db, key, keylen, tid(d), /*force*/1);
} while (r == CYRUSDB_AGAIN);
}
else {
struct buf data = BUF_INITIALIZER;
unsigned char flags = 0;
if (!value->len || value->s == NULL) {
flags |= ANNOTATE_FLAG_DELETED;
}
else {
// this is only here to allow cleanup of invalid values in the past...
// the calling of this API with a NULL "userid" is bogus, because that's
// supposed to be reserved for the make_key of prefixes - but there has
// been API abuse in the past, so some of these are in the wild. *sigh*.
// Don't allow new ones to be written
if (!userid) goto out;
}
make_entry(&data, value, modseq, flags);
#if DEBUG
syslog(LOG_ERR, "write_entry: storing key %s (value: %s) to %s (modseq=" MODSEQ_FMT ")",
key_as_string(d, key, keylen), value->s, d->filename, modseq);
#endif
do {
r = cyrusdb_store(d->db, key, keylen, data.s, data.len, tid(d));
} while (r == CYRUSDB_AGAIN);
buf_free(&data);
}
if (!mailbox)
sync_log_annotation("");
out:
annotate_putdb(&d);
buf_free(&oldval);
return r;
}
| 1
|
424,520
|
static UINT video_data_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
free(pChannelCallback);
return CHANNEL_RC_OK;
}
| 0
|
466,168
|
static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
unsigned d)
{
int rc = X86EMUL_CONTINUE;
switch (d) {
case OpReg:
decode_register_operand(ctxt, op,
op == &ctxt->dst &&
ctxt->twobyte && (ctxt->b == 0xb6 || ctxt->b == 0xb7));
break;
case OpImmUByte:
rc = decode_imm(ctxt, op, 1, false);
break;
case OpMem:
ctxt->memop.bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
mem_common:
*op = ctxt->memop;
ctxt->memopp = op;
if ((ctxt->d & BitOp) && op == &ctxt->dst)
fetch_bit_operand(ctxt);
op->orig_val = op->val;
break;
case OpMem64:
ctxt->memop.bytes = 8;
goto mem_common;
case OpAcc:
op->type = OP_REG;
op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
op->addr.reg = &ctxt->regs[VCPU_REGS_RAX];
fetch_register_operand(op);
op->orig_val = op->val;
break;
case OpDI:
op->type = OP_MEM;
op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
op->addr.mem.ea =
register_address(ctxt, ctxt->regs[VCPU_REGS_RDI]);
op->addr.mem.seg = VCPU_SREG_ES;
op->val = 0;
break;
case OpDX:
op->type = OP_REG;
op->bytes = 2;
op->addr.reg = &ctxt->regs[VCPU_REGS_RDX];
fetch_register_operand(op);
break;
case OpCL:
op->bytes = 1;
op->val = ctxt->regs[VCPU_REGS_RCX] & 0xff;
break;
case OpImmByte:
rc = decode_imm(ctxt, op, 1, true);
break;
case OpOne:
op->bytes = 1;
op->val = 1;
break;
case OpImm:
rc = decode_imm(ctxt, op, imm_size(ctxt), true);
break;
case OpMem16:
ctxt->memop.bytes = 2;
goto mem_common;
case OpMem32:
ctxt->memop.bytes = 4;
goto mem_common;
case OpImmU16:
rc = decode_imm(ctxt, op, 2, false);
break;
case OpImmU:
rc = decode_imm(ctxt, op, imm_size(ctxt), false);
break;
case OpSI:
op->type = OP_MEM;
op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
op->addr.mem.ea =
register_address(ctxt, ctxt->regs[VCPU_REGS_RSI]);
op->addr.mem.seg = seg_override(ctxt);
op->val = 0;
break;
case OpImmFAddr:
op->type = OP_IMM;
op->addr.mem.ea = ctxt->_eip;
op->bytes = ctxt->op_bytes + 2;
insn_fetch_arr(op->valptr, op->bytes, ctxt);
break;
case OpMemFAddr:
ctxt->memop.bytes = ctxt->op_bytes + 2;
goto mem_common;
case OpES:
op->val = VCPU_SREG_ES;
break;
case OpCS:
op->val = VCPU_SREG_CS;
break;
case OpSS:
op->val = VCPU_SREG_SS;
break;
case OpDS:
op->val = VCPU_SREG_DS;
break;
case OpFS:
op->val = VCPU_SREG_FS;
break;
case OpGS:
op->val = VCPU_SREG_GS;
break;
case OpImplicit:
/* Special instructions do their own operand decoding. */
default:
op->type = OP_NONE; /* Disable writeback. */
break;
}
done:
return rc;
}
| 0
|
261,195
|
static void MqttClient_RespList_Remove(MqttClient *client, MqttPendResp *rmResp)
{
MqttPendResp *tmpResp;
if (client == NULL)
return;
#ifdef WOLFMQTT_DEBUG_CLIENT
PRINTF("PendResp Remove: %p", rmResp);
#endif
/* Find the response entry */
for (tmpResp = client->firstPendResp;
tmpResp != NULL;
tmpResp = tmpResp->next)
{
if (tmpResp == rmResp) {
break;
}
}
if (tmpResp) {
/* Fix up the first and last pointers */
if (client->firstPendResp == tmpResp) {
client->firstPendResp = tmpResp->next;
}
if (client->lastPendResp == tmpResp) {
client->lastPendResp = tmpResp->prev;
}
/* Remove the entry from the list */
if (tmpResp->next != NULL) {
tmpResp->next->prev = tmpResp->prev;
}
if (tmpResp->prev != NULL) {
tmpResp->prev->next = tmpResp->next;
}
}
#ifdef WOLFMQTT_DEBUG_CLIENT
else {
PRINTF("\tPendResp Remove Failed");
}
#endif
}
| 0
|
448,472
|
vg_resource_attach_backing(VuGpu *g,
struct virtio_gpu_ctrl_command *cmd)
{
struct virtio_gpu_simple_resource *res;
struct virtio_gpu_resource_attach_backing ab;
int ret;
VUGPU_FILL_CMD(ab);
virtio_gpu_bswap_32(&ab, sizeof(ab));
res = virtio_gpu_find_resource(g, ab.resource_id);
if (!res) {
g_critical("%s: illegal resource specified %d",
__func__, ab.resource_id);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
return;
}
if (res->iov) {
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
return;
}
ret = vg_create_mapping_iov(g, &ab, cmd, &res->iov);
if (ret != 0) {
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
return;
}
res->iov_cnt = ab.nr_entries;
}
| 0
|
236,124
|
GF_Box *tx3g_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_Tx3gSampleEntryBox, GF_ISOM_BOX_TYPE_TX3G);
gf_isom_sample_entry_init((GF_SampleEntryBox *)tmp);
return (GF_Box *) tmp;
}
| 0
|
273,080
|
safe_atoi64(const char *str, int64_t *val)
{
char *end;
long long intval;
*val = 0;
errno = 0;
intval = strtoll(str, &end, 10);
if (((errno == ERANGE) && ((intval == LLONG_MAX) || (intval == LLONG_MIN)))
|| ((errno != 0) && (intval == 0)))
{
DPRINTF(E_DBG, L_MISC, "Invalid integer in string (%s): %s\n", str, strerror(errno));
return -1;
}
if (end == str)
{
DPRINTF(E_DBG, L_MISC, "No integer found in string (%s)\n", str);
return -1;
}
if (intval > INT64_MAX)
{
DPRINTF(E_DBG, L_MISC, "Integer value too large (%s)\n", str);
return -1;
}
*val = (int64_t)intval;
return 0;
}
| 0
|
326,637
|
set_time(int fd, int mode, const char *name,
time_t atime, long atime_nsec,
time_t mtime, long mtime_nsec)
{
/* Select the best implementation for this platform. */
#if defined(HAVE_UTIMENSAT) && defined(HAVE_FUTIMENS)
/*
* utimensat() and futimens() are defined in
* POSIX.1-2008. They support ns resolution and setting times
* on fds and symlinks.
*/
struct timespec ts[2];
(void)mode; /* UNUSED */
ts[0].tv_sec = atime;
ts[0].tv_nsec = atime_nsec;
ts[1].tv_sec = mtime;
ts[1].tv_nsec = mtime_nsec;
if (fd >= 0)
return futimens(fd, ts);
return utimensat(AT_FDCWD, name, ts, AT_SYMLINK_NOFOLLOW);
#elif HAVE_UTIMES
/*
* The utimes()-family functions support µs-resolution and
* setting times fds and symlinks. utimes() is documented as
* LEGACY by POSIX, futimes() and lutimes() are not described
* in POSIX.
*/
struct timeval times[2];
times[0].tv_sec = atime;
times[0].tv_usec = atime_nsec / 1000;
times[1].tv_sec = mtime;
times[1].tv_usec = mtime_nsec / 1000;
#ifdef HAVE_FUTIMES
if (fd >= 0)
return (futimes(fd, times));
#else
(void)fd; /* UNUSED */
#endif
#ifdef HAVE_LUTIMES
(void)mode; /* UNUSED */
return (lutimes(name, times));
#else
if (S_ISLNK(mode))
return (0);
return (utimes(name, times));
#endif
#elif defined(HAVE_UTIME)
/*
* utime() is POSIX-standard but only supports 1s resolution and
* does not support fds or symlinks.
*/
struct utimbuf times;
(void)fd; /* UNUSED */
(void)name; /* UNUSED */
(void)atime_nsec; /* UNUSED */
(void)mtime_nsec; /* UNUSED */
times.actime = atime;
times.modtime = mtime;
if (S_ISLNK(mode))
return (ARCHIVE_OK);
return (utime(name, ×));
#else
/*
* We don't know how to set the time on this platform.
*/
(void)fd; /* UNUSED */
(void)mode; /* UNUSED */
(void)name; /* UNUSED */
(void)atime_nsec; /* UNUSED */
(void)mtime_nsec; /* UNUSED */
return (ARCHIVE_WARN);
#endif
}
| 0
|
247,666
|
TestUtilOptionsV2& setExpectedALPNProtocol(const std::string& expected_alpn_protocol) {
expected_alpn_protocol_ = expected_alpn_protocol;
return *this;
}
| 0
|
223,419
|
static void jumpto_if_not_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg, struct sljit_label *label)
{
#if PCRE2_CODE_UNIT_WIDTH == 8
OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0);
CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0x80, label);
#elif PCRE2_CODE_UNIT_WIDTH == 16
OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00);
CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00, label);
#else
#error "Unknown code width"
#endif
}
| 0
|
244,182
|
u32 gf_isom_ctrn_field_size_bits(u32 field_idx)
{
if (field_idx==3) return 32;
return field_idx*8;
}
| 0
|
245,182
|
has_innodb_buffer_pool_dump_pct()
{
if ((server_flavor == FLAVOR_PERCONA_SERVER ||
server_flavor == FLAVOR_MYSQL) &&
mysql_server_version >= 50702) {
return(true);
}
if (server_flavor == FLAVOR_MARIADB && mysql_server_version >= 10110) {
return(true);
}
return(false);
}
| 0
|
279,942
|
free_prev_shellcmd(void)
{
vim_free(prevcmd);
}
| 0
|
307,847
|
void ciEnv::dump_inline_data(int compile_id) {
static char buffer[O_BUFLEN];
int ret = jio_snprintf(buffer, O_BUFLEN, "inline_pid%p_compid%d.log", os::current_process_id(), compile_id);
if (ret > 0) {
int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd != -1) {
FILE* inline_data_file = os::open(fd, "w");
if (inline_data_file != NULL) {
fileStream replay_data_stream(inline_data_file, /*need_close=*/true);
GUARDED_VM_ENTRY(
MutexLocker ml(Compile_lock);
dump_compile_data(&replay_data_stream);
)
replay_data_stream.flush();
tty->print("# Compiler inline data is saved as: ");
tty->print_cr("%s", buffer);
} else {
tty->print_cr("# Can't open file to dump inline data.");
}
}
}
}
| 0
|
361,300
|
stl_match_neighbors_exact(stl_file *stl,
stl_hash_edge *edge_a, stl_hash_edge *edge_b) {
if (stl->error) return;
stl_record_neighbors(stl, edge_a, edge_b);
}
| 0
|
221,419
|
static void copy_vmcb_control_area(struct vmcb_control_area *dst,
struct vmcb_control_area *from)
{
unsigned int i;
for (i = 0; i < MAX_INTERCEPT; i++)
dst->intercepts[i] = from->intercepts[i];
dst->iopm_base_pa = from->iopm_base_pa;
dst->msrpm_base_pa = from->msrpm_base_pa;
dst->tsc_offset = from->tsc_offset;
/* asid not copied, it is handled manually for svm->vmcb. */
dst->tlb_ctl = from->tlb_ctl;
dst->int_ctl = from->int_ctl;
dst->int_vector = from->int_vector;
dst->int_state = from->int_state;
dst->exit_code = from->exit_code;
dst->exit_code_hi = from->exit_code_hi;
dst->exit_info_1 = from->exit_info_1;
dst->exit_info_2 = from->exit_info_2;
dst->exit_int_info = from->exit_int_info;
dst->exit_int_info_err = from->exit_int_info_err;
dst->nested_ctl = from->nested_ctl;
dst->event_inj = from->event_inj;
dst->event_inj_err = from->event_inj_err;
dst->nested_cr3 = from->nested_cr3;
dst->virt_ext = from->virt_ext;
dst->pause_filter_count = from->pause_filter_count;
dst->pause_filter_thresh = from->pause_filter_thresh;
}
| 0
|
96,958
|
void encode(ArgumentEncoder* encoder, CFURLRef url)
{
CFURLRef baseURL = CFURLGetBaseURL(url);
encoder->encodeBool(baseURL);
if (baseURL)
encode(encoder, baseURL);
encode(encoder, CFURLGetString(url));
}
| 0
|
226,296
|
void maxr_box_del(GF_Box *s)
{
gf_free((GF_MAXRBox *)s);
}
| 0
|
294,617
|
valid_civil_sub(int argc, VALUE *argv, VALUE klass, int need_jd)
{
VALUE nth, y;
int m, d, ry, rm, rd;
double sg;
y = argv[0];
m = NUM2INT(argv[1]);
d = NUM2INT(argv[2]);
sg = NUM2DBL(argv[3]);
valid_sg(sg);
if (!need_jd && (guess_style(y, sg) < 0)) {
if (!valid_gregorian_p(y, m, d,
&nth, &ry,
&rm, &rd))
return Qnil;
return INT2FIX(0); /* dummy */
}
else {
int rjd, ns;
VALUE rjd2;
if (!valid_civil_p(y, m, d, sg,
&nth, &ry,
&rm, &rd, &rjd,
&ns))
return Qnil;
if (!need_jd)
return INT2FIX(0); /* dummy */
encode_jd(nth, rjd, &rjd2);
return rjd2;
}
}
| 0
|
294,625
|
m_df_in_day(union DateData *x)
{
return isec_to_day(m_df(x));
}
| 0
|
512,350
|
bool Item_func_between::eval_not_null_tables(void *opt_arg)
{
if (Item_func_opt_neg::eval_not_null_tables(NULL))
return 1;
/* not_null_tables_cache == union(T1(e),T1(e1),T1(e2)) */
if (pred_level && !negated)
return 0;
/* not_null_tables_cache == union(T1(e), intersection(T1(e1),T1(e2))) */
not_null_tables_cache= (args[0]->not_null_tables() |
(args[1]->not_null_tables() &
args[2]->not_null_tables()));
return 0;
}
| 0
|
247,124
|
GF_Filter *gf_fs_load_filter(GF_FilterSession *fsess, const char *name, GF_Err *err_code)
{
const char *args=NULL;
const char *sep, *file_ext;
u32 i, len, count = gf_list_count(fsess->registry);
Bool quiet = (err_code && (*err_code == GF_EOS)) ? GF_TRUE : GF_FALSE;
assert(fsess);
assert(name);
if (err_code) *err_code = GF_OK;
sep = gf_fs_path_escape_colon(fsess, name);
if (sep) {
args = sep+1;
len = (u32) (sep - name);
} else len = (u32) strlen(name);
if (!len) {
if (!quiet) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("Missing filter name in %s\n", name));
}
return NULL;
}
if (!strncmp(name, "enc", len)) {
return gf_fs_load_encoder(fsess, args);
}
/*regular filter loading*/
for (i=0;i<count;i++) {
const GF_FilterRegister *f_reg = gf_list_get(fsess->registry, i);
if ((strlen(f_reg->name)==len) && !strncmp(f_reg->name, name, len)) {
GF_Filter *filter;
GF_FilterArgType argtype = GF_FILTER_ARG_EXPLICIT;
if ((f_reg->flags & GF_FS_REG_REQUIRES_RESOLVER) && !fsess->max_resolve_chain_len) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("Filter %s requires graph resolver but it is disabled\n", name));
if (err_code) *err_code = GF_BAD_PARAM;
return NULL;
}
if (f_reg->flags & GF_FS_REG_ACT_AS_SOURCE) argtype = GF_FILTER_ARG_EXPLICIT_SOURCE;
filter = gf_filter_new(fsess, f_reg, args, NULL, argtype, err_code, NULL, GF_FALSE);
if (!filter) return NULL;
if (!filter->num_output_pids) {
//check we have a src specified for the filter
const char *src_url = strstr(name, "src");
if (src_url && (src_url[3]==fsess->sep_name)) {
const GF_FilterArgs *args = filter->instance_args ? filter->instance_args : f_reg->args;
//check the filter has an src argument
//we don't want to call process on a filter not acting as source until at least one input is connected
i=0;
while (args && args[i].arg_name) {
if (!strcmp(args[i].arg_name, "src")) {
gf_filter_post_process_task(filter);
break;
}
i++;
}
}
}
return filter;
}
}
/*check JS file*/
file_ext = gf_file_ext_start(name);
if (file_ext && (file_ext > sep) )
file_ext = NULL;
if (!file_ext || strstr(name, ".js") || strstr(name, ".jsf") || strstr(name, ".mjs") ) {
Bool file_exists = GF_FALSE;
char szName[10+GF_MAX_PATH];
char szPath[10+GF_MAX_PATH];
if (len>GF_MAX_PATH)
return NULL;
strncpy(szPath, name, len);
szPath[len]=0;
GF_LOG(GF_LOG_DEBUG, GF_LOG_FILTER, ("Trying JS filter %s\n", szPath));
if (gf_file_exists(szPath)) {
file_exists = GF_TRUE;
} else {
strcpy(szName, szPath);
file_exists = gf_fs_solve_js_script(szPath, szName, file_ext);
if (!file_exists && !file_ext) {
strcat(szName, ".js");
if (gf_file_exists(szName)) {
strncpy(szPath, name, len);
szPath[len]=0;
strcat(szPath, ".js");
file_exists = GF_TRUE;
}
}
}
if (file_exists) {
sprintf(szName, "jsf%cjs%c", fsess->sep_args, fsess->sep_name);
strcat(szName, szPath);
if (name[len])
strcat(szName, name+len);
return gf_fs_load_filter(fsess, szName, err_code);
}
}
if (!quiet) {
GF_LOG(GF_LOG_ERROR, GF_LOG_FILTER, ("Failed to load filter %s: no such filter registry\n", name));
}
if (err_code) *err_code = GF_FILTER_NOT_FOUND;
return NULL;
}
| 0
|
307,836
|
ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool,
int index, Bytecodes::Code bc,
ciInstanceKlass* accessor) {
GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);)
}
| 0
|
236,161
|
void styl_box_del(GF_Box *s)
{
GF_TextStyleBox*ptr = (GF_TextStyleBox*)s;
if (ptr->styles) gf_free(ptr->styles);
gf_free(ptr);
}
| 0
|
438,661
|
static void __exit rpmsg_fini(void)
{
unregister_virtio_driver(&virtio_ipc_driver);
}
| 0
|
241,065
|
static void client_alloc(void)
{
int i;
if (!(clients = realloc(
clients, (client_size + CLIENT_NALLOC) * sizeof(*clients))
) || !(pollfds = realloc(
pollfds, (client_size + CLIENT_NALLOC) * sizeof(*pollfds))
)) {
log_error("can't alloc for client array");
exit(1);
}
for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
clients[i].workfn = NULL;
clients[i].deadfn = NULL;
clients[i].fd = -1;
pollfds[i].fd = -1;
pollfds[i].revents = 0;
}
client_size += CLIENT_NALLOC;
}
| 0
|
225,992
|
GF_Err tfhd_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TrackFragmentHeaderBox *ptr = (GF_TrackFragmentHeaderBox *) s;
if (!s) return GF_BAD_PARAM;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->trackID);
//The rest depends on the flags
if (ptr->flags & GF_ISOM_TRAF_BASE_OFFSET) {
gf_bs_write_u64(bs, ptr->base_data_offset);
}
if (ptr->flags & GF_ISOM_TRAF_SAMPLE_DESC) {
gf_bs_write_u32(bs, ptr->sample_desc_index);
}
if (ptr->flags & GF_ISOM_TRAF_SAMPLE_DUR) {
gf_bs_write_u32(bs, ptr->def_sample_duration);
}
if (ptr->flags & GF_ISOM_TRAF_SAMPLE_SIZE) {
gf_bs_write_u32(bs, ptr->def_sample_size);
}
if (ptr->flags & GF_ISOM_TRAF_SAMPLE_FLAGS) {
gf_bs_write_u32(bs, ptr->def_sample_flags);
}
return GF_OK;
}
| 0
|
308,159
|
static void fastrpc_context_put_wq(struct work_struct *work)
{
struct fastrpc_invoke_ctx *ctx =
container_of(work, struct fastrpc_invoke_ctx, put_work);
fastrpc_context_put(ctx);
}
| 0
|
253,617
|
smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
{
struct TCP_Server_Info *server = tcon->ses->server;
unsigned int rsize;
/* start with specified rsize, or default */
rsize = ctx->rsize ? ctx->rsize : SMB3_DEFAULT_IOSIZE;
rsize = min_t(unsigned int, rsize, server->max_read);
#ifdef CONFIG_CIFS_SMB_DIRECT
if (server->rdma) {
if (server->sign)
/*
* Account for SMB2 data transfer packet header and
* possible encryption header
*/
rsize = min_t(unsigned int,
rsize,
server->smbd_conn->max_fragmented_recv_size -
SMB2_READWRITE_PDU_HEADER_SIZE -
sizeof(struct smb2_transform_hdr));
else
rsize = min_t(unsigned int,
rsize, server->smbd_conn->max_readwrite_size);
}
#endif
if (!(server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU))
rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);
return rsize;
}
| 0
|
400,709
|
int import_single_range(int rw, void __user *buf, size_t len,
struct iovec *iov, struct iov_iter *i)
{
if (len > MAX_RW_COUNT)
len = MAX_RW_COUNT;
if (unlikely(!access_ok(buf, len)))
return -EFAULT;
iov->iov_base = buf;
iov->iov_len = len;
iov_iter_init(i, rw, iov, 1, len);
return 0;
}
| 0
|
195,405
|
static Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define CropBox "CropBox"
#define DeviceCMYK "DeviceCMYK"
#define MediaBox "MediaBox"
#define RenderPCLText " Rendering PCL... "
char
command[MaxTextExtent],
*density,
filename[MaxTextExtent],
geometry[MaxTextExtent],
*options,
input_filename[MaxTextExtent];
const DelegateInfo
*delegate_info;
Image
*image,
*next_image;
ImageInfo
*read_info;
int
c;
MagickBooleanType
cmyk,
status;
PointInfo
delta;
RectangleInfo
bounding_box,
page;
char
*p;
SegmentInfo
bounds;
size_t
height,
width;
ssize_t
count;
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
/*
Open image file.
*/
image=AcquireImage(image_info);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
status=AcquireUniqueSymbolicLink(image_info->filename,input_filename);
if (status == MagickFalse)
{
ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
image_info->filename);
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Set the page density.
*/
delta.x=DefaultResolution;
delta.y=DefaultResolution;
if ((image->x_resolution == 0.0) || (image->y_resolution == 0.0))
{
GeometryInfo
geometry_info;
MagickStatusType
flags;
flags=ParseGeometry(PSDensityGeometry,&geometry_info);
if ((flags & RhoValue) != 0)
image->x_resolution=geometry_info.rho;
image->y_resolution=image->x_resolution;
if ((flags & SigmaValue) != 0)
image->y_resolution=geometry_info.sigma;
}
/*
Determine page geometry from the PCL media box.
*/
cmyk=image->colorspace == CMYKColorspace ? MagickTrue : MagickFalse;
count=0;
(void) memset(&bounding_box,0,sizeof(bounding_box));
(void) memset(&bounds,0,sizeof(bounds));
(void) memset(&page,0,sizeof(page));
(void) memset(command,0,sizeof(command));
p=command;
for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
{
if (image_info->page != (char *) NULL)
continue;
/*
Note PCL elements.
*/
*p++=(char) c;
if ((c != (int) '/') && (c != '\n') &&
((size_t) (p-command) < (MaxTextExtent-1)))
continue;
*p='\0';
p=command;
/*
Is this a CMYK document?
*/
if (LocaleNCompare(DeviceCMYK,command,strlen(DeviceCMYK)) == 0)
cmyk=MagickTrue;
if (LocaleNCompare(CropBox,command,strlen(CropBox)) == 0)
{
/*
Note region defined by crop box.
*/
count=(ssize_t) sscanf(command,"CropBox [%lf %lf %lf %lf",
&bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
if (count != 4)
count=(ssize_t) sscanf(command,"CropBox[%lf %lf %lf %lf",
&bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
}
if (LocaleNCompare(MediaBox,command,strlen(MediaBox)) == 0)
{
/*
Note region defined by media box.
*/
count=(ssize_t) sscanf(command,"MediaBox [%lf %lf %lf %lf",
&bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
if (count != 4)
count=(ssize_t) sscanf(command,"MediaBox[%lf %lf %lf %lf",
&bounds.x1,&bounds.y1,&bounds.x2,&bounds.y2);
}
if (count != 4)
continue;
/*
Set PCL render geometry.
*/
width=(size_t) floor(bounds.x2-bounds.x1+0.5);
height=(size_t) floor(bounds.y2-bounds.y1+0.5);
if (width > page.width)
page.width=width;
if (height > page.height)
page.height=height;
}
(void) CloseBlob(image);
/*
Render PCL with the GhostPCL delegate.
*/
if ((page.width == 0) || (page.height == 0))
(void) ParseAbsoluteGeometry(PSPageGeometry,&page);
if (image_info->page != (char *) NULL)
(void) ParseAbsoluteGeometry(image_info->page,&page);
(void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
page.width,(double) page.height);
if (image_info->monochrome != MagickFalse)
delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception);
else
if (cmyk != MagickFalse)
delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception);
else
delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception);
if (delegate_info == (const DelegateInfo *) NULL)
{
image=DestroyImage(image);
return((Image *) NULL);
}
if ((page.width == 0) || (page.height == 0))
(void) ParseAbsoluteGeometry(PSPageGeometry,&page);
if (image_info->page != (char *) NULL)
(void) ParseAbsoluteGeometry(image_info->page,&page);
density=AcquireString("");
options=AcquireString("");
(void) FormatLocaleString(density,MaxTextExtent,"%gx%g",
image->x_resolution,image->y_resolution);
if (image_info->ping != MagickFalse)
(void) FormatLocaleString(density,MagickPathExtent,"2.0x2.0");
page.width=(size_t) floor((double) page.width*image->x_resolution/delta.x+
0.5);
page.height=(size_t) floor((double) page.height*image->y_resolution/delta.y+
0.5);
(void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
page.width,(double) page.height);
image=DestroyImage(image);
read_info=CloneImageInfo(image_info);
*read_info->magick='\0';
if (read_info->number_scenes != 0)
{
if (read_info->number_scenes != 1)
(void) FormatLocaleString(options,MaxTextExtent,"-dLastPage=%.20g",
(double) (read_info->scene+read_info->number_scenes));
else
(void) FormatLocaleString(options,MaxTextExtent,
"-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1,
(double) (read_info->scene+read_info->number_scenes));
read_info->number_scenes=0;
if (read_info->scenes != (char *) NULL)
*read_info->scenes='\0';
}
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) AcquireUniqueFilename(read_info->filename);
(void) FormatLocaleString(command,MaxTextExtent,
GetDelegateCommands(delegate_info),
read_info->antialias != MagickFalse ? 4 : 1,
read_info->antialias != MagickFalse ? 4 : 1,density,options,
read_info->filename,input_filename);
options=DestroyString(options);
density=DestroyString(density);
status=ExternalDelegateCommand(MagickFalse,read_info->verbose,command,
(char *) NULL,exception) != 0 ? MagickTrue : MagickFalse;
image=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
(void) RelinquishUniqueFileResource(input_filename);
read_info=DestroyImageInfo(read_info);
if (image == (Image *) NULL)
ThrowReaderException(DelegateError,"PCLDelegateFailed");
if (LocaleCompare(image->magick,"BMP") == 0)
{
Image
*cmyk_image;
cmyk_image=ConsolidateCMYKImages(image,&image->exception);
if (cmyk_image != (Image *) NULL)
{
image=DestroyImageList(image);
image=cmyk_image;
}
}
do
{
(void) CopyMagickString(image->filename,filename,MaxTextExtent);
image->page=page;
if (image_info->ping != MagickFalse)
{
image->magick_columns*=image->x_resolution/2.0;
image->magick_rows*=image->y_resolution/2.0;
image->columns*=image->x_resolution/2.0;
image->rows*=image->y_resolution/2.0;
}
next_image=SyncNextImageInList(image);
if (next_image != (Image *) NULL)
image=next_image;
} while (next_image != (Image *) NULL);
return(GetFirstImageInList(image));
}
| 1
|
225,720
|
GF_Err tfdt_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TFBaseMediaDecodeTimeBox *ptr = (GF_TFBaseMediaDecodeTimeBox *) s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
if (ptr->version==1) {
gf_bs_write_u64(bs, ptr->baseMediaDecodeTime);
} else {
gf_bs_write_u32(bs, (u32) ptr->baseMediaDecodeTime);
}
return GF_OK;
| 0
|
228,448
|
bool WddxPacket::recursiveAddVar(const String& varName,
const Variant& varVariant,
bool hasVarTag) {
SeenContainers seen;
return recursiveAddVarImpl(varName, varVariant, hasVarTag, seen);
}
| 0
|
409,414
|
req_more_codes_from_term(void)
{
char buf[23]; // extra size to shut up LGTM
int old_idx = xt_index_out;
// Don't do anything when going to exit.
if (exiting)
return;
// Send up to 10 more requests out than we received. Avoid sending too
// many, there can be a buffer overflow somewhere.
while (xt_index_out < xt_index_in + 10 && key_names[xt_index_out] != NULL)
{
char *key_name = key_names[xt_index_out];
MAY_WANT_TO_LOG_THIS;
LOG_TR(("Requesting XT %d: %s", xt_index_out, key_name));
sprintf(buf, "\033P+q%02x%02x\033\\", key_name[0], key_name[1]);
out_str_nf((char_u *)buf);
++xt_index_out;
}
// Send the codes out right away.
if (xt_index_out != old_idx)
out_flush();
}
| 0
|
326,124
|
regdump(char_u *pattern, bt_regprog_T *r)
{
char_u *s;
int op = EXACTLY; // Arbitrary non-END op.
char_u *next;
char_u *end = NULL;
FILE *f;
#ifdef BT_REGEXP_LOG
f = fopen("bt_regexp_log.log", "a");
#else
f = stdout;
#endif
if (f == NULL)
return;
fprintf(f, "-------------------------------------\n\r\nregcomp(%s):\r\n", pattern);
s = r->program + 1;
// Loop until we find the END that isn't before a referred next (an END
// can also appear in a NOMATCH operand).
while (op != END || s <= end)
{
op = OP(s);
fprintf(f, "%2d%s", (int)(s - r->program), regprop(s)); // Where, what.
next = regnext(s);
if (next == NULL) // Next ptr.
fprintf(f, "(0)");
else
fprintf(f, "(%d)", (int)((s - r->program) + (next - s)));
if (end < next)
end = next;
if (op == BRACE_LIMITS)
{
// Two ints
fprintf(f, " minval %ld, maxval %ld", OPERAND_MIN(s), OPERAND_MAX(s));
s += 8;
}
else if (op == BEHIND || op == NOBEHIND)
{
// one int
fprintf(f, " count %ld", OPERAND_MIN(s));
s += 4;
}
else if (op == RE_LNUM || op == RE_COL || op == RE_VCOL)
{
// one int plus comparator
fprintf(f, " count %ld", OPERAND_MIN(s));
s += 5;
}
s += 3;
if (op == ANYOF || op == ANYOF + ADD_NL
|| op == ANYBUT || op == ANYBUT + ADD_NL
|| op == EXACTLY)
{
// Literal string, where present.
fprintf(f, "\nxxxxxxxxx\n");
while (*s != NUL)
fprintf(f, "%c", *s++);
fprintf(f, "\nxxxxxxxxx\n");
s++;
}
fprintf(f, "\r\n");
}
// Header fields of interest.
if (r->regstart != NUL)
fprintf(f, "start `%s' 0x%x; ", r->regstart < 256
? (char *)transchar(r->regstart)
: "multibyte", r->regstart);
if (r->reganch)
fprintf(f, "anchored; ");
if (r->regmust != NULL)
fprintf(f, "must have \"%s\"", r->regmust);
fprintf(f, "\r\n");
#ifdef BT_REGEXP_LOG
fclose(f);
#endif
}
| 0
|
90,110
|
CellularNetwork::CellularNetwork()
: WirelessNetwork(),
activation_state_(ACTIVATION_STATE_UNKNOWN),
network_technology_(NETWORK_TECHNOLOGY_UNKNOWN),
roaming_state_(ROAMING_STATE_UNKNOWN),
restricted_pool_(false),
prl_version_(0) {
type_ = TYPE_CELLULAR;
}
| 0
|
247,761
|
void InvertibleRWFunction::DEREncode(BufferedTransformation &bt) const
{
DERSequenceEncoder seq(bt);
m_n.DEREncode(seq);
m_p.DEREncode(seq);
m_q.DEREncode(seq);
m_u.DEREncode(seq);
seq.MessageEnd();
}
| 0
|
474,021
|
st_hash_end(st_index_t h)
{
h = murmur_step(h, 10);
h = murmur_step(h, 17);
return h;
}
| 0
|
414,925
|
xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) {
int i;
if ((cur == NULL) || (val == NULL)) return(-1);
/* @@ with_ns to check whether namespace nodes should be looked at @@ */
/*
* prevent duplcates
*/
for (i = 0;i < cur->nodeNr;i++)
if (cur->nodeTab[i] == val) return(0);
/*
* grow the nodeTab if needed
*/
if (cur->nodeMax == 0) {
cur->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT *
sizeof(xmlNodePtr));
if (cur->nodeTab == NULL) {
xmlXPathErrMemory(NULL, "growing nodeset\n");
return(-1);
}
memset(cur->nodeTab, 0 ,
XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr));
cur->nodeMax = XML_NODESET_DEFAULT;
} else if (cur->nodeNr == cur->nodeMax) {
xmlNodePtr *temp;
if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) {
xmlXPathErrMemory(NULL, "growing nodeset hit limit\n");
return(-1);
}
temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 *
sizeof(xmlNodePtr));
if (temp == NULL) {
xmlXPathErrMemory(NULL, "growing nodeset\n");
return(-1);
}
cur->nodeMax *= 2;
cur->nodeTab = temp;
}
if (val->type == XML_NAMESPACE_DECL) {
xmlNsPtr ns = (xmlNsPtr) val;
cur->nodeTab[cur->nodeNr++] =
xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns);
} else
cur->nodeTab[cur->nodeNr++] = val;
return(0);
}
| 0
|
353,012
|
uniqueMemberIndexer(
slap_mask_t use,
slap_mask_t flags,
Syntax *syntax,
MatchingRule *mr,
struct berval *prefix,
BerVarray values,
BerVarray *keysp,
void *ctx )
{
BerVarray dnvalues;
int rc;
int i;
for( i=0; !BER_BVISNULL( &values[i] ); i++ ) {
/* just count them */
}
assert( i > 0 );
dnvalues = slap_sl_malloc( sizeof( struct berval ) * (i+1), ctx );
for( i=0; !BER_BVISNULL( &values[i] ); i++ ) {
struct berval assertedDN = values[i];
struct berval assertedUID = BER_BVNULL;
if ( !BER_BVISEMPTY( &assertedDN ) ) {
assertedUID.bv_val = strrchr( assertedDN.bv_val, '#' );
if ( !BER_BVISNULL( &assertedUID ) ) {
assertedUID.bv_val++;
assertedUID.bv_len = assertedDN.bv_len
- ( assertedUID.bv_val - assertedDN.bv_val );
if ( bitStringValidate( NULL, &assertedUID ) == LDAP_SUCCESS ) {
assertedDN.bv_len -= assertedUID.bv_len + 1;
} else {
BER_BVZERO( &assertedUID );
}
}
}
dnvalues[i] = assertedDN;
}
BER_BVZERO( &dnvalues[i] );
rc = octetStringIndexer( use, flags, syntax, mr, prefix,
dnvalues, keysp, ctx );
slap_sl_free( dnvalues, ctx );
return rc;
}
| 0
|
228,443
|
void find_var_recursive(const TypedValue* tv,
const req::ptr<WddxPacket>& wddxPacket) {
if (tvIsString(tv)) {
String var_name{tvCastToString(tv)};
wddxPacket->add_var(var_name, true);
}
if (isArrayType(tv->m_type)) {
for (ArrayIter iter(tv->m_data.parr); iter; ++iter) {
find_var_recursive(iter.secondRef().asTypedValue(), wddxPacket);
}
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.