idx
int64 | func
string | target
int64 |
|---|---|---|
247,580
|
TestUtilOptions& setExpectedServerStats(const std::string& expected_server_stats) {
TestUtilOptionsBase::setExpectedServerStats(expected_server_stats);
return *this;
}
| 0
|
430,466
|
gopherTimeout(const CommTimeoutCbParams &io)
{
GopherStateData *gopherState = static_cast<GopherStateData *>(io.data);
debugs(10, 4, HERE << io.conn << ": '" << gopherState->entry->url() << "'" );
gopherState->fwd->fail(new ErrorState(ERR_READ_TIMEOUT, Http::scGatewayTimeout, gopherState->fwd->request));
if (Comm::IsConnOpen(io.conn))
io.conn->close();
}
| 0
|
380,948
|
ins_pageup(void)
{
pos_T tpos;
undisplay_dollar();
if (mod_mask & MOD_MASK_CTRL)
{
// <C-PageUp>: tab page back
if (first_tabpage->tp_next != NULL)
{
start_arrow(&curwin->w_cursor);
goto_tabpage(-1);
}
return;
}
tpos = curwin->w_cursor;
if (onepage(BACKWARD, 1L) == OK)
{
start_arrow(&tpos);
can_cindent = TRUE;
}
else
vim_beep(BO_CRSR);
}
| 0
|
277,003
|
fiber_yield(mrb_state *mrb, mrb_value self)
{
const mrb_value *a;
mrb_int len;
mrb_get_args(mrb, "*!", &a, &len);
return mrb_fiber_yield(mrb, len, a);
}
| 0
|
353,009
|
inValidate(
Syntax *syntax,
struct berval *in )
{
/* no value allowed */
return LDAP_INVALID_SYNTAX;
}
| 0
|
405,341
|
struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
const struct flowi *fl, const struct sock *sk,
int flags)
{
return xfrm_lookup_with_ifid(net, dst_orig, fl, sk, flags, 0);
}
| 0
|
195,029
|
void Node::RunForwardTypeInference() {
VLOG(4) << "Forward type inference: " << props_->node_def.DebugString();
if (props_->fwd_type_fn == nullptr) {
return;
}
std::vector<Node*> input_nodes(props_->input_types.size(), nullptr);
std::vector<int> input_idx(props_->input_types.size(), 0);
for (const auto& edge : in_edges_) {
if (edge->IsControlEdge()) {
continue;
}
DCHECK(edge->dst_input() < input_nodes.size()) << DebugString();
int i = edge->dst_input();
input_nodes.at(i) = edge->src();
input_idx.at(i) = edge->src_output();
}
// Note: technically, we could use a very generic type when some of the inputs
// are unknown. But there is an expectation that a node will have complete
// inputs soon, so updating intermediate types is largely unnecessary.
for (const auto* node : input_nodes) {
if (node == nullptr) {
// Incomplete inputs, bail.
ClearTypeInfo();
return;
}
}
static FullTypeDef* no_type = new FullTypeDef();
std::vector<std::reference_wrapper<const FullTypeDef>> input_types;
for (int i = 0; i < input_nodes.size(); i++) {
const auto* node = input_nodes[i];
if (node->def().has_experimental_type()) {
const auto& node_t = node->def().experimental_type();
if (node_t.type_id() != TFT_UNSET) {
int ix = input_idx[i];
DCHECK(ix < node_t.args_size())
<< "input " << i << " should have an output " << ix
<< " but instead only has " << node_t.args_size()
<< " outputs: " << node_t.DebugString();
input_types.emplace_back(node_t.args(ix));
} else {
input_types.emplace_back(*no_type);
}
} else {
// Incomplete inputs, bail.
ClearTypeInfo();
return;
}
}
const auto infer_type = props_->fwd_type_fn(input_types);
const FullTypeDef infer_typedef = infer_type.ValueOrDie();
if (infer_typedef.type_id() != TFT_UNSET) {
MaybeCopyOnWrite();
*(props_->node_def.mutable_experimental_type()) = infer_typedef;
}
}
| 1
|
395,065
|
showruler(int always)
{
if (!always && !redrawing())
return;
if (pum_visible())
{
// Don't redraw right now, do it later.
curwin->w_redr_status = TRUE;
return;
}
#if defined(FEAT_STL_OPT)
if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
redraw_custom_statusline(curwin);
else
#endif
#ifdef FEAT_CMDL_INFO
win_redr_ruler(curwin, always, FALSE);
#endif
#ifdef FEAT_TITLE
if (need_maketitle
# ifdef FEAT_STL_OPT
|| (p_icon && (stl_syntax & STL_IN_ICON))
|| (p_title && (stl_syntax & STL_IN_TITLE))
# endif
)
maketitle();
#endif
// Redraw the tab pages line if needed.
if (redraw_tabline)
draw_tabline();
}
| 0
|
329,897
|
line_exceeds_16_16 (const cairo_line_t *line)
{
return
line->p1.x <= CAIRO_FIXED_16_16_MIN ||
line->p1.x >= CAIRO_FIXED_16_16_MAX ||
line->p2.x <= CAIRO_FIXED_16_16_MIN ||
line->p2.x >= CAIRO_FIXED_16_16_MAX ||
line->p1.y <= CAIRO_FIXED_16_16_MIN ||
line->p1.y >= CAIRO_FIXED_16_16_MAX ||
line->p2.y <= CAIRO_FIXED_16_16_MIN ||
line->p2.y >= CAIRO_FIXED_16_16_MAX;
}
| 0
|
326,094
|
reginsert_limits(
int op,
long minval,
long maxval,
char_u *opnd)
{
char_u *src;
char_u *dst;
char_u *place;
if (regcode == JUST_CALC_SIZE)
{
regsize += 11;
return;
}
src = regcode;
regcode += 11;
dst = regcode;
while (src > opnd)
*--dst = *--src;
place = opnd; // Op node, where operand used to be.
*place++ = op;
*place++ = NUL;
*place++ = NUL;
place = re_put_long(place, (long_u)minval);
place = re_put_long(place, (long_u)maxval);
regtail(opnd, place);
}
| 0
|
314,526
|
PJ_DEF(pj_status_t) pjmedia_sdp_attr_remove( unsigned *count,
pjmedia_sdp_attr *attr_array[],
pjmedia_sdp_attr *attr )
{
unsigned i, removed=0;
PJ_ASSERT_RETURN(count && attr_array && attr, PJ_EINVAL);
PJ_ASSERT_RETURN(*count <= PJMEDIA_MAX_SDP_ATTR, PJ_ETOOMANY);
for (i=0; i<*count; ) {
if (attr_array[i] == attr) {
pj_array_erase(attr_array, sizeof(pjmedia_sdp_attr*),
*count, i);
--(*count);
++removed;
} else {
++i;
}
}
return removed ? PJ_SUCCESS : PJ_ENOTFOUND;
}
| 0
|
230,382
|
PJ_DEF(void) pj_xml_add_attr( pj_xml_node *node, pj_xml_attr *attr )
{
pj_list_push_back(&node->attr_head, attr);
}
| 0
|
230,613
|
bool PBMotion::operator==(const PBMotion& b) const
{
const PBMotion& a = *this;
// TODO: is this really correct? no check for predFlag? Standard says so... (p.127)
for (int i=0;i<2;i++) {
if (a.predFlag[i] != b.predFlag[i]) return false;
if (a.predFlag[i]) {
if (a.mv[i].x != b.mv[i].x) return false;
if (a.mv[i].y != b.mv[i].y) return false;
if (a.refIdx[i] != b.refIdx[i]) return false;
}
}
return true;
}
| 0
|
432,256
|
void address_space_remove_listeners(AddressSpace *as)
{
while (!QTAILQ_EMPTY(&as->listeners)) {
memory_listener_unregister(QTAILQ_FIRST(&as->listeners));
}
}
| 0
|
220,437
|
mrb_ary_aset(mrb_state *mrb, mrb_value self)
{
mrb_value v1, v2, v3;
mrb_int i, len;
ary_modify(mrb, mrb_ary_ptr(self));
if (mrb_get_argc(mrb) == 2) {
const mrb_value *vs = mrb_get_argv(mrb);
v1 = vs[0]; v2 = vs[1];
/* a[n..m] = v */
switch (mrb_range_beg_len(mrb, v1, &i, &len, RARRAY_LEN(self), FALSE)) {
case MRB_RANGE_TYPE_MISMATCH:
mrb_ary_set(mrb, self, aget_index(mrb, v1), v2);
break;
case MRB_RANGE_OK:
mrb_ary_splice(mrb, self, i, len, v2);
break;
case MRB_RANGE_OUT:
mrb_raisef(mrb, E_RANGE_ERROR, "%v out of range", v1);
break;
}
return v2;
}
mrb_get_args(mrb, "ooo", &v1, &v2, &v3);
/* a[n,m] = v */
mrb_ary_splice(mrb, self, aget_index(mrb, v1), aget_index(mrb, v2), v3);
return v3;
}
| 0
|
336,642
|
SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *reds, const char* dest,
int port, int secure_port,
const char* cert_subject)
{
SpiceMigrateInterface *sif;
int try_seamless;
spice_debug("trace");
spice_assert(reds->migration_interface);
if (reds->expect_migrate) {
spice_debug("consecutive calls without migration. Canceling previous call");
reds->main_channel->migrate_src_complete(FALSE);
}
sif = SPICE_UPCAST(SpiceMigrateInterface, reds->migration_interface->base.sif);
if (!reds_set_migration_dest_info(reds, dest, port, secure_port, cert_subject)) {
sif->migrate_connect_complete(reds->migration_interface);
return -1;
}
reds->expect_migrate = TRUE;
/*
* seamless migration support was added to the client after the support in
* agent_connect_tokens, so there shouldn't be contradicition - if
* the client is capable of seamless migration, it is capbable of agent_connected_tokens.
* The demand for agent_connected_tokens support is in order to assure that if migration
* occured when the agent was not connected, the tokens state after migration will still
* be valid (see reds_reset_vdp for more details).
*/
try_seamless = reds->seamless_migration_enabled &&
reds->main_channel->test_remote_cap(SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS);
/* main channel will take care of clients that are still during migration (at target)*/
if (reds->main_channel->migrate_connect(reds->config->mig_spice, try_seamless)) {
reds_mig_started(reds);
} else {
if (reds->clients.empty()) {
reds_mig_release(reds->config);
spice_debug("no client connected");
}
sif->migrate_connect_complete(reds->migration_interface);
}
return 0;
}
| 0
|
441,808
|
SProcXkbSetControls(ClientPtr client)
{
REQUEST(xkbSetControlsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xkbSetControlsReq);
swaps(&stuff->deviceSpec);
swaps(&stuff->affectInternalVMods);
swaps(&stuff->internalVMods);
swaps(&stuff->affectIgnoreLockVMods);
swaps(&stuff->ignoreLockVMods);
swaps(&stuff->axOptions);
swapl(&stuff->affectEnabledCtrls);
swapl(&stuff->enabledCtrls);
swapl(&stuff->changeCtrls);
swaps(&stuff->repeatDelay);
swaps(&stuff->repeatInterval);
swaps(&stuff->slowKeysDelay);
swaps(&stuff->debounceDelay);
swaps(&stuff->mkDelay);
swaps(&stuff->mkInterval);
swaps(&stuff->mkTimeToMax);
swaps(&stuff->mkMaxSpeed);
swaps(&stuff->mkCurve);
swaps(&stuff->axTimeout);
swapl(&stuff->axtCtrlsMask);
swapl(&stuff->axtCtrlsValues);
swaps(&stuff->axtOptsMask);
swaps(&stuff->axtOptsValues);
return ProcXkbSetControls(client);
}
| 0
|
344,755
|
addargs(arglist *args, char *fmt, ...)
{
va_list ap;
char *cp;
u_int nalloc;
int r;
va_start(ap, fmt);
r = vasprintf(&cp, fmt, ap);
va_end(ap);
if (r == -1)
fatal("addargs: argument too long");
nalloc = args->nalloc;
if (args->list == NULL) {
nalloc = 32;
args->num = 0;
} else if (args->num+2 >= nalloc)
nalloc *= 2;
args->list = xrecallocarray(args->list, args->nalloc, nalloc, sizeof(char *));
args->nalloc = nalloc;
args->list[args->num++] = cp;
args->list[args->num] = NULL;
}
| 0
|
242,619
|
void Compute(OpKernelContext* ctx) override {
Buffer* buf = nullptr;
OP_REQUIRES_OK(ctx, GetBuffer(ctx, def(), &buf));
core::ScopedUnref scope(buf);
Buffer::Tuple tuple;
buf->Get(&tuple);
OP_REQUIRES(
ctx, tuple.size() == (size_t)ctx->num_outputs(),
errors::InvalidArgument("Mismatch stage/unstage: ", tuple.size(),
" vs. ", ctx->num_outputs()));
for (size_t i = 0; i < tuple.size(); ++i) {
ctx->set_output(i, tuple[i]);
}
}
| 0
|
427,799
|
void sev_vm_destroy(struct kvm *kvm)
{
struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
struct list_head *head = &sev->regions_list;
struct list_head *pos, *q;
if (!sev_guest(kvm))
return;
/* If this is a mirror_kvm release the enc_context_owner and skip sev cleanup */
if (is_mirroring_enc_context(kvm)) {
kvm_put_kvm(sev->enc_context_owner);
return;
}
mutex_lock(&kvm->lock);
/*
* Ensure that all guest tagged cache entries are flushed before
* releasing the pages back to the system for use. CLFLUSH will
* not do this, so issue a WBINVD.
*/
wbinvd_on_all_cpus();
/*
* if userspace was terminated before unregistering the memory regions
* then lets unpin all the registered memory.
*/
if (!list_empty(head)) {
list_for_each_safe(pos, q, head) {
__unregister_enc_region_locked(kvm,
list_entry(pos, struct enc_region, list));
cond_resched();
}
}
mutex_unlock(&kvm->lock);
sev_unbind_asid(kvm, sev->handle);
sev_asid_free(sev);
}
| 0
|
230,297
|
njs_array_add(njs_vm_t *vm, njs_array_t *array, njs_value_t *value)
{
njs_int_t ret;
ret = njs_array_expand(vm, array, 0, 1);
if (njs_fast_path(ret == NJS_OK)) {
/* GC: retain value. */
array->start[array->length++] = *value;
}
return ret;
}
| 0
|
244,004
|
static GF_Err ctrn_box_size(GF_TrackFragmentRunBox *ctrn)
{
Bool use_ctso_multi = GF_TRUE;
u32 i, count;
GF_TrunEntry *ent;
ctrn->ctrn_flags = 0;
ctrn->ctrn_first_dur = ctrn->ctrn_first_size = ctrn->ctrn_first_sample_flags = ctrn->ctrn_first_ctts = 0;
ctrn->ctrn_dur = ctrn->ctrn_size = ctrn->ctrn_sample_flags = ctrn->ctrn_ctts = 0;
ctrn->size += 2; //16 bits for sample count
if (ctrn->flags & GF_ISOM_TRUN_DATA_OFFSET) {
ctrn->ctrn_flags |= GF_ISOM_TRUN_DATA_OFFSET;
if (ABS(ctrn->data_offset) < 32767) {
ctrn->size += 2;
ctrn->ctrn_flags |= GF_ISOM_CTRN_DATAOFFSET_16;
} else
ctrn->size += 4;
}
count = gf_list_count(ctrn->entries);
if (ctrn->ctso_multiplier && (ctrn->flags & GF_ISOM_TRUN_CTS_OFFSET) && (ctrn->ctso_multiplier<=0xFFFF) ) {
for (i=0; i<count; i++) {
GF_TrunEntry *a_ent = gf_list_get(ctrn->entries, i);
if (a_ent->CTS_Offset % ctrn->ctso_multiplier) {
use_ctso_multi = GF_FALSE;
break;
}
}
} else {
use_ctso_multi = GF_FALSE;
}
if (ctrn->use_inherit) {
use_ctso_multi = GF_FALSE;
ctrn->ctrn_flags |= 0xB0; //duration=1,size=0,flags=1,cts=1 << 4
}
if (use_ctso_multi) {
ctrn->size += 2;
ctrn->ctrn_flags |= GF_ISOM_CTRN_CTSO_MULTIPLIER;
} else {
ctrn->ctso_multiplier = 0;
}
/*we always write first sample using first flags*/
ent = gf_list_get(ctrn->entries, 0);
ctrn->ctrn_flags |= GF_ISOM_CTRN_FIRST_SAMPLE;
if (!ctrn->use_inherit && (ctrn->flags & GF_ISOM_TRUN_DURATION)) {
ctrn->ctrn_first_dur = ctrn_u32_to_index(ent->Duration);
if (ctrn->ctrn_first_dur) {
ctrn->size += ctrn_field_size(ctrn->ctrn_first_dur);
ctrn->ctrn_flags |= ctrn->ctrn_first_dur<<22;
}
}
if (ctrn->flags & GF_ISOM_TRUN_SIZE) {
ctrn->ctrn_first_size = ctrn_u32_to_index(ent->size);
if (ctrn->ctrn_first_size) {
ctrn->size += ctrn_field_size(ctrn->ctrn_first_size);
ctrn->ctrn_flags |= ctrn->ctrn_first_size<<20;
}
}
if (!ctrn->use_inherit && (ctrn->flags & GF_ISOM_TRUN_FLAGS)) {
ctrn->ctrn_first_sample_flags = ctrn_sample_flags_to_index(ent->flags);
if (ctrn->ctrn_first_sample_flags) {
ctrn->size += ctrn_field_size(ctrn->ctrn_first_sample_flags);
ctrn->ctrn_flags |= ctrn->ctrn_first_sample_flags<<18;
}
}
if (!ctrn->use_inherit && (ctrn->flags & GF_ISOM_TRUN_CTS_OFFSET)) {
ctrn->ctrn_first_ctts = ctrn_ctts_to_index(ctrn, ent->CTS_Offset);
if (ctrn->ctrn_first_ctts) {
ctrn->size += ctrn_field_size(ctrn->ctrn_first_ctts);
ctrn->ctrn_flags |= ctrn->ctrn_first_ctts<<16;
}
}
for (i=1; i<count; i++) {
u8 field_idx;
GF_TrunEntry *a_ent = gf_list_get(ctrn->entries, i);
if (!ctrn->use_inherit && (ctrn->flags & GF_ISOM_TRUN_DURATION)) {
field_idx = ctrn_u32_to_index(a_ent->Duration);
if (ctrn->ctrn_dur < field_idx)
ctrn->ctrn_dur = field_idx;
}
if (ctrn->flags & GF_ISOM_TRUN_SIZE) {
field_idx = ctrn_u32_to_index(a_ent->size);
if (ctrn->ctrn_size < field_idx)
ctrn->ctrn_size = field_idx;
}
if (!ctrn->use_inherit && (ctrn->flags & GF_ISOM_TRUN_FLAGS)) {
field_idx = ctrn_sample_flags_to_index(a_ent->flags);
if (ctrn->ctrn_sample_flags < field_idx)
ctrn->ctrn_sample_flags = field_idx;
}
if (!ctrn->use_inherit) {
field_idx = ctrn_ctts_to_index(ctrn, a_ent->CTS_Offset);
if (ctrn->ctrn_ctts < field_idx)
ctrn->ctrn_ctts = field_idx;
}
}
count-=1;
if (ctrn->ctrn_dur) {
ctrn->size += count * ctrn_field_size(ctrn->ctrn_dur);
ctrn->ctrn_flags |= ctrn->ctrn_dur<<14;
}
if (ctrn->ctrn_size) {
ctrn->size += count * ctrn_field_size(ctrn->ctrn_size);
ctrn->ctrn_flags |= ctrn->ctrn_size<<12;
}
if (ctrn->ctrn_sample_flags) {
ctrn->size += count * ctrn_field_size(ctrn->ctrn_sample_flags);
ctrn->ctrn_flags |= ctrn->ctrn_sample_flags<<10;
}
if (ctrn->ctrn_ctts) {
ctrn->size += count * ctrn_field_size(ctrn->ctrn_ctts);
ctrn->ctrn_flags |= ctrn->ctrn_ctts<<8;
}
return GF_OK;
}
| 0
|
387,863
|
JNIid::JNIid(Klass* holder, int offset, JNIid* next) {
_holder = holder;
_offset = offset;
_next = next;
debug_only(_is_static_field_id = false;)
}
| 0
|
474,027
|
get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
const OnigCodePoint* ranges[], OnigEncoding enc ARG_UNUSED)
{
if (ctype <= ONIGENC_MAX_STD_CTYPE) {
return ONIG_NO_SUPPORT_CONFIG;
}
else {
*sb_out = 0x80;
PROPERTY_LIST_INIT_CHECK;
ctype -= (ONIGENC_MAX_STD_CTYPE + 1);
if (ctype >= (OnigCtype )PropertyListNum)
return ONIGERR_TYPE_BUG;
*ranges = PropertyList[ctype];
return 0;
}
}
| 0
|
211,915
|
jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr)
{
jp2_box_t *box;
int found;
jas_image_t *image;
jp2_dec_t *dec;
bool samedtype;
int dtype;
unsigned int i;
jp2_cmap_t *cmapd;
jp2_pclr_t *pclrd;
jp2_cdef_t *cdefd;
unsigned int channo;
int newcmptno;
int_fast32_t *lutents;
#if 0
jp2_cdefchan_t *cdefent;
int cmptno;
#endif
jp2_cmapent_t *cmapent;
jas_icchdr_t icchdr;
jas_iccprof_t *iccprof;
dec = 0;
box = 0;
image = 0;
JAS_DBGLOG(100, ("jp2_decode(%p, \"%s\")\n", in, optstr));
if (!(dec = jp2_dec_create())) {
goto error;
}
/* Get the first box. This should be a JP box. */
if (!(box = jp2_box_get(in))) {
jas_eprintf("error: cannot get box\n");
goto error;
}
if (box->type != JP2_BOX_JP) {
jas_eprintf("error: expecting signature box\n");
goto error;
}
if (box->data.jp.magic != JP2_JP_MAGIC) {
jas_eprintf("incorrect magic number\n");
goto error;
}
jp2_box_destroy(box);
box = 0;
/* Get the second box. This should be a FTYP box. */
if (!(box = jp2_box_get(in))) {
goto error;
}
if (box->type != JP2_BOX_FTYP) {
jas_eprintf("expecting file type box\n");
goto error;
}
jp2_box_destroy(box);
box = 0;
/* Get more boxes... */
found = 0;
while ((box = jp2_box_get(in))) {
if (jas_getdbglevel() >= 1) {
jas_eprintf("got box type %s\n", box->info->name);
}
switch (box->type) {
case JP2_BOX_JP2C:
found = 1;
break;
case JP2_BOX_IHDR:
if (!dec->ihdr) {
dec->ihdr = box;
box = 0;
}
break;
case JP2_BOX_BPCC:
if (!dec->bpcc) {
dec->bpcc = box;
box = 0;
}
break;
case JP2_BOX_CDEF:
if (!dec->cdef) {
dec->cdef = box;
box = 0;
}
break;
case JP2_BOX_PCLR:
if (!dec->pclr) {
dec->pclr = box;
box = 0;
}
break;
case JP2_BOX_CMAP:
if (!dec->cmap) {
dec->cmap = box;
box = 0;
}
break;
case JP2_BOX_COLR:
if (!dec->colr) {
dec->colr = box;
box = 0;
}
break;
}
if (box) {
jp2_box_destroy(box);
box = 0;
}
if (found) {
break;
}
}
if (!found) {
jas_eprintf("error: no code stream found\n");
goto error;
}
if (!(dec->image = jpc_decode(in, optstr))) {
jas_eprintf("error: cannot decode code stream\n");
goto error;
}
/* An IHDR box must be present. */
if (!dec->ihdr) {
jas_eprintf("error: missing IHDR box\n");
goto error;
}
/* Does the number of components indicated in the IHDR box match
the value specified in the code stream? */
if (dec->ihdr->data.ihdr.numcmpts != JAS_CAST(jas_uint,
jas_image_numcmpts(dec->image))) {
jas_eprintf("warning: number of components mismatch\n");
}
/* At least one component must be present. */
if (!jas_image_numcmpts(dec->image)) {
jas_eprintf("error: no components\n");
goto error;
}
/* Determine if all components have the same data type. */
samedtype = true;
dtype = jas_image_cmptdtype(dec->image, 0);
for (i = 1; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {
if (jas_image_cmptdtype(dec->image, i) != dtype) {
samedtype = false;
break;
}
}
/* Is the component data type indicated in the IHDR box consistent
with the data in the code stream? */
if ((samedtype && dec->ihdr->data.ihdr.bpc != JP2_DTYPETOBPC(dtype)) ||
(!samedtype && dec->ihdr->data.ihdr.bpc != JP2_IHDR_BPCNULL)) {
jas_eprintf("warning: component data type mismatch\n");
}
/* Is the compression type supported? */
if (dec->ihdr->data.ihdr.comptype != JP2_IHDR_COMPTYPE) {
jas_eprintf("error: unsupported compression type\n");
goto error;
}
if (dec->bpcc) {
/* Is the number of components indicated in the BPCC box
consistent with the code stream data? */
if (dec->bpcc->data.bpcc.numcmpts != JAS_CAST(jas_uint, jas_image_numcmpts(
dec->image))) {
jas_eprintf("warning: number of components mismatch\n");
}
/* Is the component data type information indicated in the BPCC
box consistent with the code stream data? */
if (!samedtype) {
for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));
++i) {
if (jas_image_cmptdtype(dec->image, i) !=
JP2_BPCTODTYPE(dec->bpcc->data.bpcc.bpcs[i])) {
jas_eprintf("warning: component data type mismatch\n");
}
}
} else {
jas_eprintf("warning: superfluous BPCC box\n");
}
}
/* A COLR box must be present. */
if (!dec->colr) {
jas_eprintf("error: no COLR box\n");
goto error;
}
switch (dec->colr->data.colr.method) {
case JP2_COLR_ENUM:
jas_image_setclrspc(dec->image, jp2_getcs(&dec->colr->data.colr));
break;
case JP2_COLR_ICC:
iccprof = jas_iccprof_createfrombuf(dec->colr->data.colr.iccp,
dec->colr->data.colr.iccplen);
if (!iccprof) {
jas_eprintf("error: failed to parse ICC profile\n");
goto error;
}
jas_iccprof_gethdr(iccprof, &icchdr);
jas_eprintf("ICC Profile CS %08x\n", icchdr.colorspc);
jas_image_setclrspc(dec->image, fromiccpcs(icchdr.colorspc));
dec->image->cmprof_ = jas_cmprof_createfromiccprof(iccprof);
assert(dec->image->cmprof_);
jas_iccprof_destroy(iccprof);
break;
}
/* If a CMAP box is present, a PCLR box must also be present. */
if (dec->cmap && !dec->pclr) {
jas_eprintf("warning: missing PCLR box or superfluous CMAP box\n");
jp2_box_destroy(dec->cmap);
dec->cmap = 0;
}
/* If a CMAP box is not present, a PCLR box must not be present. */
if (!dec->cmap && dec->pclr) {
jas_eprintf("warning: missing CMAP box or superfluous PCLR box\n");
jp2_box_destroy(dec->pclr);
dec->pclr = 0;
}
/* Determine the number of channels (which is essentially the number
of components after any palette mappings have been applied). */
dec->numchans = dec->cmap ? dec->cmap->data.cmap.numchans :
JAS_CAST(jas_uint, jas_image_numcmpts(dec->image));
/* Perform a basic sanity check on the CMAP box if present. */
if (dec->cmap) {
for (i = 0; i < dec->numchans; ++i) {
/* Is the component number reasonable? */
if (dec->cmap->data.cmap.ents[i].cmptno >= JAS_CAST(jas_uint,
jas_image_numcmpts(dec->image))) {
jas_eprintf("error: invalid component number in CMAP box\n");
goto error;
}
/* Is the LUT index reasonable? */
if (dec->cmap->data.cmap.ents[i].pcol >=
dec->pclr->data.pclr.numchans) {
jas_eprintf("error: invalid CMAP LUT index\n");
goto error;
}
}
}
/* Allocate space for the channel-number to component-number LUT. */
if (!(dec->chantocmptlut = jas_alloc2(dec->numchans,
sizeof(uint_fast16_t)))) {
jas_eprintf("error: no memory\n");
goto error;
}
if (!dec->cmap) {
for (i = 0; i < dec->numchans; ++i) {
dec->chantocmptlut[i] = i;
}
} else {
cmapd = &dec->cmap->data.cmap;
pclrd = &dec->pclr->data.pclr;
cdefd = &dec->cdef->data.cdef;
for (channo = 0; channo < cmapd->numchans; ++channo) {
cmapent = &cmapd->ents[channo];
if (cmapent->map == JP2_CMAP_DIRECT) {
dec->chantocmptlut[channo] = channo;
} else if (cmapent->map == JP2_CMAP_PALETTE) {
lutents = jas_alloc2(pclrd->numlutents, sizeof(int_fast32_t));
for (i = 0; i < pclrd->numlutents; ++i) {
lutents[i] = pclrd->lutdata[cmapent->pcol + i * pclrd->numchans];
}
newcmptno = jas_image_numcmpts(dec->image);
jas_image_depalettize(dec->image, cmapent->cmptno,
pclrd->numlutents, lutents,
JP2_BPCTODTYPE(pclrd->bpc[cmapent->pcol]), newcmptno);
dec->chantocmptlut[channo] = newcmptno;
jas_free(lutents);
#if 0
if (dec->cdef) {
cdefent = jp2_cdef_lookup(cdefd, channo);
if (!cdefent) {
abort();
}
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), cdefent->type, cdefent->assoc));
} else {
jas_image_setcmpttype(dec->image, newcmptno, jp2_getct(jas_image_clrspc(dec->image), 0, channo + 1));
}
#endif
}
}
}
/* Mark all components as being of unknown type. */
for (i = 0; i < JAS_CAST(jas_uint, jas_image_numcmpts(dec->image)); ++i) {
jas_image_setcmpttype(dec->image, i, JAS_IMAGE_CT_UNKNOWN);
}
/* Determine the type of each component. */
if (dec->cdef) {
for (i = 0; i < dec->numchans; ++i) {
/* Is the channel number reasonable? */
if (dec->cdef->data.cdef.ents[i].channo >= dec->numchans) {
jas_eprintf("error: invalid channel number in CDEF box\n");
goto error;
}
jas_image_setcmpttype(dec->image,
dec->chantocmptlut[dec->cdef->data.cdef.ents[i].channo],
jp2_getct(jas_image_clrspc(dec->image),
dec->cdef->data.cdef.ents[i].type,
dec->cdef->data.cdef.ents[i].assoc));
}
} else {
for (i = 0; i < dec->numchans; ++i) {
jas_image_setcmpttype(dec->image, dec->chantocmptlut[i],
jp2_getct(jas_image_clrspc(dec->image), 0, i + 1));
}
}
/* Delete any components that are not of interest. */
for (i = jas_image_numcmpts(dec->image); i > 0; --i) {
if (jas_image_cmpttype(dec->image, i - 1) == JAS_IMAGE_CT_UNKNOWN) {
jas_image_delcmpt(dec->image, i - 1);
}
}
/* Ensure that some components survived. */
if (!jas_image_numcmpts(dec->image)) {
jas_eprintf("error: no components\n");
goto error;
}
#if 0
jas_eprintf("no of components is %d\n", jas_image_numcmpts(dec->image));
#endif
/* Prevent the image from being destroyed later. */
image = dec->image;
dec->image = 0;
jp2_dec_destroy(dec);
return image;
error:
if (box) {
jp2_box_destroy(box);
}
if (dec) {
jp2_dec_destroy(dec);
}
return 0;
}
| 1
|
512,390
|
int save_in_field(Field *field, bool no_conversions)
{
DBUG_ASSERT(sane());
if (null_value)
return set_field_to_null(field);
Timestamp_or_zero_datetime_native native(m_value, decimals);
return native.save_in_field(field, decimals);
}
| 0
|
328,893
|
R_API void r_bin_java_print_local_variable_attr_summary(RBinJavaLocalVariableAttribute *lvattr) {
if (!lvattr) {
eprintf ("Attempting to print an invalid RBinJavaLocalVariableAttribute *.\n");
return;
}
printf (" Local Variable Attribute offset: 0x%08"PFMT64x "\n", lvattr->file_offset);
printf (" Local Variable Attribute start_pc: %d\n", lvattr->start_pc);
printf (" Local Variable Attribute Length: %d\n", lvattr->length);
printf (" Local Variable Attribute name_idx: %d\n", lvattr->name_idx);
printf (" Local Variable Attribute name: %s\n", lvattr->name);
printf (" Local Variable Attribute descriptor_idx: %d\n", lvattr->descriptor_idx);
printf (" Local Variable Attribute descriptor: %s\n", lvattr->descriptor);
printf (" Local Variable Attribute index: %d\n", lvattr->index);
}
| 0
|
353,229
|
void SplashOutputDev::updateStrokeOpacity(GfxState *state) {
splash->setStrokeAlpha((SplashCoord)state->getStrokeOpacity());
if (transpGroupStack != nullptr && (SplashCoord)state->getStrokeOpacity() < transpGroupStack->knockoutOpacity) {
transpGroupStack->knockoutOpacity = (SplashCoord)state->getStrokeOpacity();
}
}
| 0
|
247,645
|
Network::Address::IpVersion version() const { return version_; }
| 0
|
313,542
|
static int rose_node_show(struct seq_file *seq, void *v)
{
char rsbuf[11];
int i;
if (v == SEQ_START_TOKEN)
seq_puts(seq, "address mask n neigh neigh neigh\n");
else {
const struct rose_node *rose_node = v;
seq_printf(seq, "%-10s %04d %d",
rose2asc(rsbuf, &rose_node->address),
rose_node->mask,
rose_node->count);
for (i = 0; i < rose_node->count; i++)
seq_printf(seq, " %05d", rose_node->neighbour[i]->number);
seq_puts(seq, "\n");
}
return 0;
}
| 0
|
512,634
|
bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode)
{
return type_handler_year.Item_get_date_with_warn(thd, this, to, mode);
}
| 0
|
310,128
|
_nc_retrace_unsigned(unsigned code)
{
T((T_RETURN("%#x"), code));
return code;
}
| 0
|
274,685
|
callbacks_viewmenu_rendertype_changed (GtkCheckMenuItem *widget, gpointer user_data) {
gerbv_render_types_t type = GPOINTER_TO_INT(user_data);
if (type == screenRenderInfo.renderType)
return;
dprintf ("%s(): type = %d\n", __FUNCTION__, type);
screenRenderInfo.renderType = type;
callbacks_render_type_changed ();
}
| 0
|
259,180
|
static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
unsigned i, entries;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
avio_rb32(pb); // version + flags
entries = avio_rb32(pb);
if (sc->stps_data)
av_log(c->fc, AV_LOG_WARNING, "Duplicated STPS atom\n");
av_free(sc->stps_data);
sc->stps_count = 0;
sc->stps_data = av_malloc_array(entries, sizeof(*sc->stps_data));
if (!sc->stps_data)
return AVERROR(ENOMEM);
for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->stps_data[i] = avio_rb32(pb);
}
sc->stps_count = i;
if (pb->eof_reached) {
av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted STPS atom\n");
return AVERROR_EOF;
}
return 0;
}
| 0
|
500,078
|
print_krb5_keyblock(char *label, krb5_keyblock *keyblk)
{
int i;
if (keyblk == NULL)
{
printf("%s, keyblk==0\n", label);
return;
}
#ifdef KRB5_HEIMDAL
printf("%s\n\t[et%d:%d]: ", label, keyblk->keytype,
keyblk->keyvalue->length);
for (i=0; i < (int)keyblk->keyvalue->length; i++)
{
printf("%02x",(unsigned char *)(keyblk->keyvalue->contents)[i]);
}
printf("\n");
#else
printf("%s\n\t[et%d:%d]: ", label, keyblk->enctype, keyblk->length);
for (i=0; i < (int)keyblk->length; i++)
{
printf("%02x",keyblk->contents[i]);
}
printf("\n");
#endif
}
| 0
|
366,201
|
int path_umount(struct path *path, int flags)
{
struct mount *mnt = real_mount(path->mnt);
int ret;
ret = can_umount(path, flags);
if (!ret)
ret = do_umount(mnt, flags);
/* we mustn't call path_put() as that would clear mnt_expiry_mark */
dput(path->dentry);
mntput_no_expire(mnt);
return ret;
}
| 0
|
512,705
|
double val_real()
{
DBUG_ASSERT(0); // never should be called
null_value= true;
return 0.0;
}
| 0
|
214,003
|
HandleCoRREBPP (rfbClient* client, int rx, int ry, int rw, int rh)
{
rfbRREHeader hdr;
int i;
CARDBPP pix;
uint8_t *ptr;
int x, y, w, h;
if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbRREHeader))
return FALSE;
hdr.nSubrects = rfbClientSwap32IfLE(hdr.nSubrects);
if (!ReadFromRFBServer(client, (char *)&pix, sizeof(pix)))
return FALSE;
client->GotFillRect(client, rx, ry, rw, rh, pix);
if (hdr.nSubrects * (4 + (BPP / 8)) > RFB_BUFFER_SIZE || !ReadFromRFBServer(client, client->buffer, hdr.nSubrects * (4 + (BPP / 8))))
return FALSE;
ptr = (uint8_t *)client->buffer;
for (i = 0; i < hdr.nSubrects; i++) {
pix = *(CARDBPP *)ptr;
ptr += BPP/8;
x = *ptr++;
y = *ptr++;
w = *ptr++;
h = *ptr++;
client->GotFillRect(client, rx+x, ry+y, w, h, pix);
}
return TRUE;
}
| 1
|
261,525
|
static bool check_buffer(RBinFile *bf, RBuffer *b) {
if (r_buf_size (b) >= 0x20) {
ut8 magic[4] = {0};
if (r_buf_read_at (b, 0, magic, sizeof (magic)) != 4) {
return false;
}
return !memcmp (magic, "XALZ", 4);
}
return false;
}
| 0
|
236,129
|
GF_Box *tbox_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TextBoxBox, GF_ISOM_BOX_TYPE_TBOX);
return (GF_Box *) tmp;
}
| 0
|
312,576
|
qf_list_entry(qfline_T *qfp, int qf_idx, int cursel)
{
char_u *fname;
buf_T *buf;
int filter_entry;
fname = NULL;
if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", qf_idx,
(char *)qfp->qf_module);
else {
if (qfp->qf_fnum != 0
&& (buf = buflist_findnr(qfp->qf_fnum)) != NULL)
{
fname = buf->b_fname;
if (qfp->qf_type == 1) // :helpgrep
fname = gettail(fname);
}
if (fname == NULL)
sprintf((char *)IObuff, "%2d", qf_idx);
else
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
qf_idx, (char *)fname);
}
// Support for filtering entries using :filter /pat/ clist
// Match against the module name, file name, search pattern and
// text of the entry.
filter_entry = TRUE;
if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
filter_entry &= message_filtered(qfp->qf_module);
if (filter_entry && fname != NULL)
filter_entry &= message_filtered(fname);
if (filter_entry && qfp->qf_pattern != NULL)
filter_entry &= message_filtered(qfp->qf_pattern);
if (filter_entry)
filter_entry &= message_filtered(qfp->qf_text);
if (filter_entry)
return;
msg_putchar('\n');
msg_outtrans_attr(IObuff, cursel ? HL_ATTR(HLF_QFL) : qfFileAttr);
if (qfp->qf_lnum != 0)
msg_puts_attr(":", qfSepAttr);
if (qfp->qf_lnum == 0)
IObuff[0] = NUL;
else
qf_range_text(qfp, IObuff, IOSIZE);
sprintf((char *)IObuff + STRLEN(IObuff), "%s",
(char *)qf_types(qfp->qf_type, qfp->qf_nr));
msg_puts_attr((char *)IObuff, qfLineAttr);
msg_puts_attr(":", qfSepAttr);
if (qfp->qf_pattern != NULL)
{
qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
msg_puts((char *)IObuff);
msg_puts_attr(":", qfSepAttr);
}
msg_puts(" ");
{
char_u *tbuf = IObuff;
size_t tbuflen = IOSIZE;
size_t len = STRLEN(qfp->qf_text) + 3;
if (len > IOSIZE)
{
tbuf = alloc(len);
if (tbuf != NULL)
tbuflen = len;
else
tbuf = IObuff;
}
// Remove newlines and leading whitespace from the text. For an
// unrecognized line keep the indent, the compiler may mark a word
// with ^^^^.
qf_fmt_text((fname != NULL || qfp->qf_lnum != 0)
? skipwhite(qfp->qf_text) : qfp->qf_text,
tbuf, (int)tbuflen);
msg_prt_line(tbuf, FALSE);
if (tbuf != IObuff)
vim_free(tbuf);
}
out_flush(); // show one line at a time
}
| 0
|
246,645
|
static void naludmx_reset_param_sets(GF_NALUDmxCtx *ctx, Bool do_free)
{
naludmx_del_param_list(ctx->sps, do_free);
naludmx_del_param_list(ctx->pps, do_free);
naludmx_del_param_list(ctx->vps, do_free);
naludmx_del_param_list(ctx->sps_ext, do_free);
naludmx_del_param_list(ctx->pps_svc, do_free);
naludmx_del_param_list(ctx->vvc_aps_pre, do_free);
naludmx_del_param_list(ctx->vvc_dci, do_free);
}
| 0
|
289,286
|
static int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val,
int dir)
{
int changed = _snd_pcm_hw_param_set(params, var, val, dir);
if (changed < 0)
return changed;
if (params->rmask) {
int err = snd_pcm_hw_refine(pcm, params);
if (err < 0)
return err;
}
return snd_pcm_hw_param_value(params, var, NULL);
}
| 0
|
521,485
|
int ZipFile::getNumEntries() const noexcept
{
return entries.size();
}
| 0
|
338,098
|
void WasmBinaryWriter::writeUserSection(const UserSection& section) {
auto start = startSection(BinaryConsts::User);
writeInlineString(section.name.c_str());
for (size_t i = 0; i < section.data.size(); i++) {
o << uint8_t(section.data[i]);
}
finishSection(start);
}
| 0
|
409,455
|
ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx)
{
if (nr < 16)
{
*r = ansi_table[nr][0];
*g = ansi_table[nr][1];
*b = ansi_table[nr][2];
*ansi_idx = nr;
}
else
{
*r = 0;
*g = 0;
*b = 0;
*ansi_idx = ANSI_INDEX_NONE;
}
}
| 0
|
233,946
|
MONGO_COMPILER_NOINLINE void DocumentSourceUnionWith::logShardedViewFound(
const ExceptionFor<ErrorCodes::CommandOnShardedViewNotSupportedOnMongod>& e) {
LOGV2_DEBUG(4556300,
3,
"$unionWith found view definition. ns: {ns}, pipeline: {pipeline}. New "
"$unionWith sub-pipeline: {new_pipe}",
"ns"_attr = e->getNamespace(),
"pipeline"_attr = Value(e->getPipeline()),
"new_pipe"_attr = _pipeline->serializeToBson());
}
| 0
|
404,706
|
static unsigned int count_open_files(struct fdtable *fdt)
{
unsigned int size = fdt->max_fds;
unsigned int i;
/* Find the last open fd */
for (i = size / BITS_PER_LONG; i > 0; ) {
if (fdt->open_fds[--i])
break;
}
i = (i + 1) * BITS_PER_LONG;
return i;
}
| 0
|
90,775
|
void QuotaManager::GetLRUOrigin(
StorageType type,
GetLRUOriginCallback* callback) {
LazyInitialize();
DCHECK(!lru_origin_callback_.get());
lru_origin_callback_.reset(callback);
if (db_disabled_) {
lru_origin_callback_->Run(GURL());
lru_origin_callback_.reset();
return;
}
scoped_refptr<GetLRUOriginTask> task(new GetLRUOriginTask(
this, type, origins_in_use_,
origins_in_error_, callback_factory_.NewCallback(
&QuotaManager::DidGetDatabaseLRUOrigin)));
task->Start();
}
| 0
|
437,367
|
is_left(int a)
{
if (a == ANCHOR_END_BUF || a == ANCHOR_SEMI_END_BUF ||
a == ANCHOR_END_LINE || a == ANCHOR_PREC_READ || a == ANCHOR_PREC_READ_NOT)
return 0;
return 1;
}
| 0
|
223,389
|
static SLJIT_INLINE void reset_ovector(compiler_common *common, int length)
{
DEFINE_COMPILER;
struct sljit_label *loop;
sljit_s32 i;
/* At this point we can freely use all temporary registers. */
SLJIT_ASSERT(length > 1);
/* TMP1 returns with begin - 1. */
OP2(SLJIT_SUB, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_S0), SLJIT_OFFSETOF(jit_arguments, begin), SLJIT_IMM, IN_UCHARS(1));
if (length < 8)
{
for (i = 1; i < length; i++)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(i), SLJIT_R0, 0);
}
else
{
if (sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw)) == SLJIT_SUCCESS)
{
GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START);
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
loop = LABEL();
sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_STORE | SLJIT_MEM_PRE, SLJIT_R0, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw));
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
else
{
GET_LOCAL_BASE(SLJIT_R1, 0, OVECTOR_START + sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
loop = LABEL();
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), 0, SLJIT_R0, 0);
OP2(SLJIT_ADD, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, sizeof(sljit_sw));
OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
}
}
| 0
|
310,116
|
save_string(char *d, const char *const s)
{
size_t have = (size_t) (d - my_string);
size_t need = have + strlen(s) + 2;
if (need > my_length) {
my_string = (char *) _nc_doalloc(my_string, my_length = (need + need));
if (my_string == 0)
_nc_err_abort(MSG_NO_MEMORY);
d = my_string + have;
}
_nc_STRCPY(d, s, my_length - have);
return d + strlen(d);
}
| 0
|
512,625
|
int save_in_field(Field *field, bool no_conversions)
{ return save_date_in_field(field, no_conversions); }
| 0
|
401,594
|
static void add_interrupt_bench(cycles_t start)
{
long delta = random_get_entropy() - start;
/* Use a weighted moving average */
delta = delta - ((avg_cycles + FIXED_1_2) >> AVG_SHIFT);
avg_cycles += delta;
/* And average deviation */
delta = abs(delta) - ((avg_deviation + FIXED_1_2) >> AVG_SHIFT);
avg_deviation += delta;
}
| 0
|
291,774
|
static struct rtrs_clt_path *get_next_path_min_latency(struct path_it *it)
{
struct rtrs_clt_path *min_path = NULL;
struct rtrs_clt_sess *clt = it->clt;
struct rtrs_clt_path *clt_path;
ktime_t min_latency = KTIME_MAX;
ktime_t latency;
list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry) {
if (READ_ONCE(clt_path->state) != RTRS_CLT_CONNECTED)
continue;
if (!list_empty(raw_cpu_ptr(clt_path->mp_skip_entry)))
continue;
latency = clt_path->s.hb_cur_latency;
if (latency < min_latency) {
min_latency = latency;
min_path = clt_path;
}
}
/*
* add the path to the skip list, so that next time we can get
* a different one
*/
if (min_path)
list_add(raw_cpu_ptr(min_path->mp_skip_entry), &it->skip_list);
return min_path;
}
| 0
|
509,508
|
bool maria_show_status(handlerton *hton,
THD *thd,
stat_print_fn *print,
enum ha_stat_type stat)
{
const LEX_CSTRING *engine_name= hton_name(hton);
switch (stat) {
case HA_ENGINE_LOGS:
{
TRANSLOG_ADDRESS horizon= translog_get_horizon();
uint32 last_file= LSN_FILE_NO(horizon);
uint32 first_needed= translog_get_first_needed_file();
uint32 first_file= translog_get_first_file(horizon);
uint32 i;
const char unknown[]= "unknown";
const char needed[]= "in use";
const char unneeded[]= "free";
char path[FN_REFLEN];
if (first_file == 0)
{
const char error[]= "error";
print(thd, engine_name->str, engine_name->length,
STRING_WITH_LEN(""), error, sizeof(error) - 1);
break;
}
for (i= first_file; i <= last_file; i++)
{
char *file;
const char *status;
size_t length, status_len;
MY_STAT stat_buff, *stat;
const char error[]= "can't stat";
char object[SHOW_MSG_LEN];
file= translog_filename_by_fileno(i, path);
if (!(stat= mysql_file_stat(key_file_translog, file, &stat_buff, MYF(0))))
{
status= error;
status_len= sizeof(error) - 1;
length= my_snprintf(object, SHOW_MSG_LEN, "Size unknown ; %s", file);
}
else
{
if (first_needed == 0)
{
status= unknown;
status_len= sizeof(unknown) - 1;
}
else if (i < first_needed)
{
status= unneeded;
status_len= sizeof(unneeded) - 1;
}
else
{
status= needed;
status_len= sizeof(needed) - 1;
}
length= my_snprintf(object, SHOW_MSG_LEN, "Size %12llu ; %s",
(ulonglong) stat->st_size, file);
}
print(thd, engine_name->str, engine_name->length,
object, length, status, status_len);
}
break;
}
case HA_ENGINE_STATUS:
case HA_ENGINE_MUTEX:
default:
break;
}
return 0;
}
| 0
|
259,207
|
static int mov_read_rtmd_track(AVFormatContext *s, AVStream *st)
{
MOVStreamContext *sc = st->priv_data;
FFStream *const sti = ffstream(st);
char buf[AV_TIMECODE_STR_SIZE];
int64_t cur_pos = avio_tell(sc->pb);
int hh, mm, ss, ff, drop;
if (!sti->nb_index_entries)
return -1;
avio_seek(sc->pb, sti->index_entries->pos, SEEK_SET);
avio_skip(s->pb, 13);
hh = avio_r8(s->pb);
mm = avio_r8(s->pb);
ss = avio_r8(s->pb);
drop = avio_r8(s->pb);
ff = avio_r8(s->pb);
snprintf(buf, AV_TIMECODE_STR_SIZE, "%02d:%02d:%02d%c%02d",
hh, mm, ss, drop ? ';' : ':', ff);
av_dict_set(&st->metadata, "timecode", buf, 0);
avio_seek(sc->pb, cur_pos, SEEK_SET);
return 0;
}
| 0
|
512,711
|
bool Item_func_case::aggregate_then_and_else_arguments(THD *thd, uint start)
{
if (aggregate_for_result(func_name(), args + start, arg_count - start, true))
return true;
if (fix_attributes(args + start, arg_count - start))
return true;
return false;
}
| 0
|
244,242
|
GF_Err dmlp_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TrueHDConfigBox *ptr = (GF_TrueHDConfigBox *)s;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->format_info);
gf_bs_write_int(bs, ptr->peak_data_rate, 15);
gf_bs_write_int(bs, 0, 1);
gf_bs_write_u32(bs, 0);
return GF_OK;
}
| 0
|
231,673
|
TEST_F(
QuicUnencryptedServerTransportTest,
TestReceiveClientFinishedFromChangedPeerAddress) {
auto qLogger = std::make_shared<FileQLogger>(VantagePoint::Server);
server->getNonConstConn().qLogger = qLogger;
recvClientHello();
folly::SocketAddress newPeer("100.101.102.103", 23456);
try {
recvClientFinished(true, &newPeer);
} catch (const std::runtime_error& ex) {
EXPECT_EQ(std::string(ex.what()), "Invalid migration");
}
EXPECT_TRUE(server->getConn().localConnectionError);
EXPECT_EQ(
server->getConn().localConnectionError->second,
"Migration not allowed during handshake");
EXPECT_TRUE(server->isClosed());
std::vector<int> indices =
getQLogEventIndices(QLogEventType::PacketDrop, qLogger);
EXPECT_EQ(indices.size(), 1);
auto tmp = std::move(qLogger->logs[indices[0]]);
auto event = dynamic_cast<QLogPacketDropEvent*>(tmp.get());
EXPECT_EQ(event->packetSize, 44);
EXPECT_EQ(
event->dropReason,
QuicTransportStatsCallback::toString(
PacketDropReason::PEER_ADDRESS_CHANGE));
}
| 0
|
253,629
|
smb2_is_status_pending(char *buf, struct TCP_Server_Info *server)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
int scredits, in_flight;
if (shdr->Status != STATUS_PENDING)
return false;
if (shdr->CreditRequest) {
spin_lock(&server->req_lock);
server->credits += le16_to_cpu(shdr->CreditRequest);
scredits = server->credits;
in_flight = server->in_flight;
spin_unlock(&server->req_lock);
wake_up(&server->request_q);
trace_smb3_add_credits(server->CurrentMid,
server->conn_id, server->hostname, scredits,
le16_to_cpu(shdr->CreditRequest), in_flight);
cifs_dbg(FYI, "%s: status pending add %u credits total=%d\n",
__func__, le16_to_cpu(shdr->CreditRequest), scredits);
}
return true;
}
| 0
|
430,365
|
static void *single_next(struct seq_file *p, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
| 0
|
328,826
|
R_API char *r_bin_java_unmangle_method(const char *flags, const char *name, const char *params, const char *r_value) {
RList *the_list = params ? r_bin_java_extract_type_values (params) : r_list_new ();
RListIter *iter = NULL;
// second case removes leading space if no flags are given
const char *fmt = flags ? "%s %s %s (%s)" : "%s%s %s (%s)";
char *str = NULL, *f_val_str = NULL, *r_val_str = NULL, *prototype = NULL, *p_val_str = NULL;
ut32 params_idx = 0, params_len = 0, prototype_len = 0;
if (!extract_type_value (r_value, &r_val_str)) {
r_list_free (the_list);
return NULL;
}
if (!r_val_str) {
r_val_str = strdup ("UNKNOWN");
}
f_val_str = strdup (r_str_get (flags));
r_list_foreach (the_list, iter, str) {
params_len += strlen (str);
if (params_idx > 0) {
params_len += 2;
}
params_idx++;
}
if (params_len > 0) {
ut32 offset = 0;
params_len += 1;
p_val_str = malloc (params_len);
r_list_foreach (the_list, iter, str) {
if (offset != 0) {
offset += snprintf (p_val_str + offset, params_len - offset, ", %s", str);
} else {
offset += snprintf (p_val_str + offset, params_len - offset, "%s", str);
}
}
} else {
p_val_str = strdup ("");
}
prototype_len += (flags ? strlen (flags) + 1 : 0); // space vs no space
prototype_len += strlen (name) + 1; // name + space
prototype_len += strlen (r_val_str) + 1; // r_value + space
prototype_len += strlen (p_val_str) + 3; // space + l_paren + params + r_paren
prototype_len += 1; // null
prototype = malloc (prototype_len);
/// TODO enable this function and start using it to demangle strings
snprintf (prototype, prototype_len, fmt, f_val_str, r_val_str, name, p_val_str);
free (f_val_str);
free (r_val_str);
free (p_val_str);
r_list_free (the_list);
return prototype;
}
| 0
|
175,772
|
explicit DatabaseTaskBase(QuotaManager* manager)
: QuotaThreadTask(manager, manager->db_thread_),
manager_(manager),
database_(manager->database_.get()),
db_disabled_(false) {
DCHECK(manager_);
DCHECK(database_);
}
| 0
|
512,992
|
virtual const longlong *const_ptr_longlong() const { return NULL; }
| 0
|
254,026
|
static struct v4l2_loopback_device *v4l2loopback_getdevice(struct file *f)
{
struct video_device *loopdev = video_devdata(f);
struct v4l2loopback_private *ptr =
(struct v4l2loopback_private *)video_get_drvdata(loopdev);
int nr = ptr->devicenr;
if (nr < 0 || nr >= devices) {
printk(KERN_ERR "v4l2-loopback: illegal device %d\n", nr);
return NULL;
}
return devs[nr];
}
| 0
|
242,115
|
LuaSettings::LuaSettings(const std::string &filename, bool write_allowed) :
m_filename(filename),
m_is_own_settings(true),
m_write_allowed(write_allowed)
{
m_settings = new Settings();
m_settings->readConfigFile(filename.c_str());
}
| 0
|
90,816
|
CallbackList& callbacks() { return callbacks_; }
| 0
|
474,044
|
left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end, OnigEncoding enc)
{
const UChar *p;
if (s <= start) return (UChar* )s;
p = s;
while (!emacsmule_islead(*p) && p > start) p--;
return (UChar* )p;
}
| 0
|
513,152
|
my_bool mark_changed(int, const struct my_option *opt, char *)
{
if (opt->app_type)
{
sys_var *var= (sys_var*) opt->app_type;
var->value_origin= sys_var::CONFIG;
}
return 0;
}
| 0
|
308,188
|
static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
int len, void *priv, u32 addr)
{
struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev);
struct fastrpc_invoke_rsp *rsp = data;
struct fastrpc_invoke_ctx *ctx;
unsigned long flags;
unsigned long ctxid;
if (len < sizeof(*rsp))
return -EINVAL;
ctxid = ((rsp->ctx & FASTRPC_CTXID_MASK) >> 4);
spin_lock_irqsave(&cctx->lock, flags);
ctx = idr_find(&cctx->ctx_idr, ctxid);
spin_unlock_irqrestore(&cctx->lock, flags);
if (!ctx) {
dev_err(&rpdev->dev, "No context ID matches response\n");
return -ENOENT;
}
ctx->retval = rsp->retval;
complete(&ctx->work);
/*
* The DMA buffer associated with the context cannot be freed in
* interrupt context so schedule it through a worker thread to
* avoid a kernel BUG.
*/
schedule_work(&ctx->put_work);
return 0;
}
| 0
|
326,103
|
regstack_push(regstate_T state, char_u *scan)
{
regitem_T *rp;
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp)
{
emsg(_(e_pattern_uses_more_memory_than_maxmempattern));
return NULL;
}
if (ga_grow(®stack, sizeof(regitem_T)) == FAIL)
return NULL;
rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len);
rp->rs_state = state;
rp->rs_scan = scan;
regstack.ga_len += sizeof(regitem_T);
return rp;
}
| 0
|
229,294
|
std::unique_ptr<cql_server::response> cql_server::connection::make_function_failure_error(int16_t stream, exceptions::exception_code err, sstring msg, sstring ks_name, sstring func_name, std::vector<sstring> args, const tracing::trace_state_ptr& tr_state) const
{
auto response = std::make_unique<cql_server::response>(stream, cql_binary_opcode::ERROR, tr_state);
response->write_int(static_cast<int32_t>(err));
response->write_string(msg);
response->write_string(ks_name);
response->write_string(func_name);
response->write_string_list(args);
return response;
}
| 0
|
259,301
|
static int mov_read_svq3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
return mov_read_extradata(c, pb, atom, AV_CODEC_ID_SVQ3);
}
| 0
|
361,305
|
stl_remove_unconnected_facets(stl_file *stl) {
/* A couple of things need to be done here. One is to remove any */
/* completely unconnected facets (0 edges connected) since these are */
/* useless and could be completely wrong. The second thing that needs to */
/* be done is to remove any degenerate facets that were created during */
/* stl_check_facets_nearby(). */
int i;
if (stl->error) return;
/* remove degenerate facets */
for(i = 0; i < stl->stats.number_of_facets; i++) {
if( !memcmp(&stl->facet_start[i].vertex[0],
&stl->facet_start[i].vertex[1], sizeof(stl_vertex))
|| !memcmp(&stl->facet_start[i].vertex[1],
&stl->facet_start[i].vertex[2], sizeof(stl_vertex))
|| !memcmp(&stl->facet_start[i].vertex[0],
&stl->facet_start[i].vertex[2], sizeof(stl_vertex))) {
stl_remove_degenerate(stl, i);
i--;
}
}
if(stl->stats.connected_facets_1_edge < stl->stats.number_of_facets) {
/* remove completely unconnected facets */
for(i = 0; i < stl->stats.number_of_facets; i++) {
if( (stl->neighbors_start[i].neighbor[0] == -1)
&& (stl->neighbors_start[i].neighbor[1] == -1)
&& (stl->neighbors_start[i].neighbor[2] == -1)) {
/* This facet is completely unconnected. Remove it. */
stl_remove_facet(stl, i);
i--;
}
}
}
}
| 0
|
512,986
|
longlong Item_func_regex::val_int()
{
DBUG_ASSERT(fixed == 1);
if ((null_value= re.recompile(args[1])))
return 0;
if ((null_value= re.exec(args[0], 0, 0)))
return 0;
return re.match();
}
| 0
|
432,167
|
static void listener_add_address_space(MemoryListener *listener,
AddressSpace *as)
{
FlatView *view;
FlatRange *fr;
if (listener->begin) {
listener->begin(listener);
}
view = address_space_get_flatview(as);
FOR_EACH_FLAT_RANGE(fr, view) {
MemoryRegionSection section = section_from_flat_range(fr, view);
if (listener->region_add) {
listener->region_add(listener, §ion);
}
}
if (listener->commit) {
listener->commit(listener);
}
}
| 0
|
409,474
|
tgoto(char *cm, int x, int y)
{
static char buf[30];
char *p, *s, *e;
if (!cm)
return "OOPS";
e = buf + 29;
for (s = buf; s < e && *cm; cm++)
{
if (*cm != '%')
{
*s++ = *cm;
continue;
}
switch (*++cm)
{
case 'd':
p = (char *)tltoa((unsigned long)y);
y = x;
while (*p)
*s++ = *p++;
break;
case 'i':
x++;
y++;
break;
case '+':
*s++ = (char)(*++cm + y);
y = x;
break;
case '%':
*s++ = *cm;
break;
default:
return "OOPS";
}
}
*s = '\0';
return buf;
}
| 0
|
272,369
|
void cms_set_pw_data(cms_context *cms, secuPWData *pwdata)
{
ingress();
switch (cms->pwdata.source) {
case PW_SOURCE_INVALID:
case PW_PROMPT:
case PW_DEVICE:
case PW_SOURCE_MAX:
break;
case PW_FROMFD:
if (cms->pwdata.intdata >= 0 &&
!(pwdata && pwdata->source == PW_FROMFD &&
cms->pwdata.intdata == pwdata->intdata))
close(cms->pwdata.intdata);
break;
case PW_FROMFILEDB:
case PW_FROMENV:
case PW_FROMFILE:
case PW_PLAINTEXT:
memset(cms->pwdata.data, 0, strlen(cms->pwdata.data));
xfree(cms->pwdata.data);
break;
case PW_DATABASE:
xfree(cms->pwdata.data);
break;
}
if (!pwdata) {
cms->pwdata.source = PW_SOURCE_INVALID;
dprintf("pwdata:NULL");
} else {
memmove(&cms->pwdata, pwdata, sizeof(*pwdata));
dprintf("pwdata:%p", pwdata);
dprintf("pwdata->source:%d", pwdata->source);
dprintf("pwdata->data:%p (\"%s\")", pwdata->data,
pwdata->data ? pwdata->data : "(null)");
}
egress();
}
| 0
|
244,169
|
GF_Box *tref_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TrackReferenceBox, GF_ISOM_BOX_TYPE_TREF);
return (GF_Box *)tmp;
}
| 0
|
351,174
|
static double length2d_polyline (int n, const double *x, const double *y) {
double length = 0.0;
for (int i = 1; i < n; i++) {
length += sqrt((x[i] - x[i-1])*(x[i] - x[i-1])
+
(y[i] - y[i-1])*(y[i] - y[i-1]));
}
return length;
}
| 0
|
235,645
|
static void copy_query(pj_pool_t *pool, pj_dns_parsed_query *dst,
const pj_dns_parsed_query *src,
unsigned *nametable_count,
pj_str_t nametable[])
{
pj_memcpy(dst, src, sizeof(*src));
apply_name_table(nametable_count, nametable, &src->name, pool, &dst->name);
}
| 0
|
217,564
|
static inline signed int ReadPropertyMSBLong(const unsigned char **p,
size_t *length)
{
union
{
unsigned int
unsigned_value;
signed int
signed_value;
} quantum;
int
c;
ssize_t
i;
unsigned char
buffer[4];
unsigned int
value;
if (*length < 4)
return(-1);
for (i=0; i < 4; i++)
{
c=(int) (*(*p)++);
(*length)--;
buffer[i]=(unsigned char) c;
}
value=(unsigned int) buffer[0] << 24;
value|=(unsigned int) buffer[1] << 16;
value|=(unsigned int) buffer[2] << 8;
value|=(unsigned int) buffer[3];
quantum.unsigned_value=value & 0xffffffff;
return(quantum.signed_value);
}
| 0
|
314,536
|
static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len)
{
char *p = buf;
char *end = buf+len;
unsigned i;
int printed;
/* check length for the "m=" line. */
if (len < (pj_size_t)m->desc.media.slen+m->desc.transport.slen+12+24) {
return -1;
}
*p++ = 'm'; /* m= */
*p++ = '=';
pj_memcpy(p, m->desc.media.ptr, m->desc.media.slen);
p += m->desc.media.slen;
*p++ = ' ';
printed = pj_utoa(m->desc.port, p);
p += printed;
if (m->desc.port_count > 1) {
*p++ = '/';
printed = pj_utoa(m->desc.port_count, p);
p += printed;
}
*p++ = ' ';
pj_memcpy(p, m->desc.transport.ptr, m->desc.transport.slen);
p += m->desc.transport.slen;
for (i=0; i<m->desc.fmt_count; ++i) {
if (end-p > m->desc.fmt[i].slen) {
*p++ = ' ';
pj_memcpy(p, m->desc.fmt[i].ptr, m->desc.fmt[i].slen);
p += m->desc.fmt[i].slen;
} else {
return -1;
}
}
if (end-p >= 2) {
*p++ = '\r';
*p++ = '\n';
} else {
return -1;
}
/* print connection info, if present. */
if (m->conn) {
printed = print_connection_info(m->conn, p, (int)(end-p));
if (printed < 0) {
return -1;
}
p += printed;
}
/* print optional bandwidth info. */
for (i=0; i<m->bandw_count; ++i) {
printed = (int)print_bandw(m->bandw[i], p, end-p);
if (printed < 0) {
return -1;
}
p += printed;
}
/* print attributes. */
for (i=0; i<m->attr_count; ++i) {
printed = (int)print_attr(m->attr[i], p, end-p);
if (printed < 0) {
return -1;
}
p += printed;
}
return (int)(p-buf);
}
| 0
|
333,497
|
static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)
{
const gdFixed f_127 = gd_itofx(127);
register int c = src->tpixels[y][x];
c = c | (( (int) (gd_fxtof(gd_mulfx(coverage, f_127)) + 50.5f)) << 24);
return _color_blend(bgColor, c);
}
| 0
|
498,137
|
void cgit_print_error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
cgit_vprint_error(fmt, ap);
va_end(ap);
}
| 0
|
252,362
|
static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d,
mz_uint8 lit) {
d->m_total_lz_bytes++;
*d->m_pLZ_code_buf++ = lit;
*d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> 1);
if (--d->m_num_flags_left == 0) {
d->m_num_flags_left = 8;
d->m_pLZ_flags = d->m_pLZ_code_buf++;
}
d->m_huff_count[0][lit]++;
}
| 0
|
427,704
|
main(int argc, char *argv[])
{
int i;
cdf_header_t h;
cdf_sat_t sat, ssat;
cdf_stream_t sst, scn;
cdf_dir_t dir;
cdf_info_t info;
const cdf_directory_t *root;
#ifdef __linux__
#define getprogname() __progname
extern char *__progname;
#endif
if (argc < 2) {
(void)fprintf(stderr, "Usage: %s <filename>\n", getprogname());
return -1;
}
info.i_buf = NULL;
info.i_len = 0;
for (i = 1; i < argc; i++) {
if ((info.i_fd = open(argv[1], O_RDONLY)) == -1)
err(EXIT_FAILURE, "Cannot open `%s'", argv[1]);
if (cdf_read_header(&info, &h) == -1)
err(EXIT_FAILURE, "Cannot read header");
#ifdef CDF_DEBUG
cdf_dump_header(&h);
#endif
if (cdf_read_sat(&info, &h, &sat) == -1)
err(EXIT_FAILURE, "Cannot read sat");
#ifdef CDF_DEBUG
cdf_dump_sat("SAT", &sat, CDF_SEC_SIZE(&h));
#endif
if (cdf_read_ssat(&info, &h, &sat, &ssat) == -1)
err(EXIT_FAILURE, "Cannot read ssat");
#ifdef CDF_DEBUG
cdf_dump_sat("SSAT", &ssat, CDF_SHORT_SEC_SIZE(&h));
#endif
if (cdf_read_dir(&info, &h, &sat, &dir) == -1)
err(EXIT_FAILURE, "Cannot read dir");
if (cdf_read_short_stream(&info, &h, &sat, &dir, &sst, &root)
== -1)
err(EXIT_FAILURE, "Cannot read short stream");
#ifdef CDF_DEBUG
cdf_dump_stream(&sst);
#endif
#ifdef CDF_DEBUG
cdf_dump_dir(&info, &h, &sat, &ssat, &sst, &dir);
#endif
if (cdf_read_summary_info(&info, &h, &sat, &ssat, &sst, &dir,
&scn) == -1)
warn("Cannot read summary info");
#ifdef CDF_DEBUG
else
cdf_dump_summary_info(&h, &scn);
#endif
if (cdf_read_user_stream(&info, &h, &sat, &ssat, &sst,
&dir, "Catalog", &scn) == -1)
warn("Cannot read catalog");
#ifdef CDF_DEBUG
else
cdf_dump_catalog(&h, &scn);
#endif
(void)close(info.i_fd);
}
return 0;
}
| 0
|
317,033
|
static int selinux_getprocattr(struct task_struct *p,
char *name, char **value)
{
const struct task_security_struct *__tsec;
u32 sid;
int error;
unsigned len;
rcu_read_lock();
__tsec = selinux_cred(__task_cred(p));
if (current != p) {
error = avc_has_perm(&selinux_state,
current_sid(), __tsec->sid,
SECCLASS_PROCESS, PROCESS__GETATTR, NULL);
if (error)
goto bad;
}
if (!strcmp(name, "current"))
sid = __tsec->sid;
else if (!strcmp(name, "prev"))
sid = __tsec->osid;
else if (!strcmp(name, "exec"))
sid = __tsec->exec_sid;
else if (!strcmp(name, "fscreate"))
sid = __tsec->create_sid;
else if (!strcmp(name, "keycreate"))
sid = __tsec->keycreate_sid;
else if (!strcmp(name, "sockcreate"))
sid = __tsec->sockcreate_sid;
else {
error = -EINVAL;
goto bad;
}
rcu_read_unlock();
if (!sid)
return 0;
error = security_sid_to_context(&selinux_state, sid, value, &len);
if (error)
return error;
return len;
bad:
rcu_read_unlock();
return error;
}
| 0
|
405,702
|
static void xemaclite_adjust_link(struct net_device *ndev)
{
struct net_local *lp = netdev_priv(ndev);
struct phy_device *phy = lp->phy_dev;
int link_state;
/* hash together the state values to decide if something has changed */
link_state = phy->speed | (phy->duplex << 1) | phy->link;
if (lp->last_link != link_state) {
lp->last_link = link_state;
phy_print_status(phy);
}
}
| 0
|
90,901
|
bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const {
return special_storage_policy_.get() &&
special_storage_policy_->IsStorageUnlimited(origin);
}
| 0
|
359,276
|
DEFUN (no_neighbor_description,
no_neighbor_description_cmd,
NO_NEIGHBOR_CMD2 "description",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"Neighbor specific description\n")
{
struct peer *peer;
peer = peer_and_group_lookup_vty (vty, argv[0]);
if (! peer)
return CMD_WARNING;
peer_description_unset (peer);
return CMD_SUCCESS;
}
| 0
|
329,893
|
composite_glyphs (void *_dst,
cairo_operator_t op,
cairo_surface_t *_src,
int src_x,
int src_y,
int dst_x,
int dst_y,
cairo_composite_glyphs_info_t *info)
{
cairo_scaled_glyph_t *glyph_cache[64];
pixman_image_t *dst, *src;
cairo_status_t status;
int i;
TRACE ((stderr, "%s\n", __FUNCTION__));
if (info->num_glyphs == 1)
return composite_one_glyph(_dst, op, _src, src_x, src_y, dst_x, dst_y, info);
if (info->use_mask)
return composite_glyphs_via_mask(_dst, op, _src, src_x, src_y, dst_x, dst_y, info);
op = _pixman_operator (op);
dst = to_pixman_image (_dst);
src = ((cairo_image_source_t *)_src)->pixman_image;
memset (glyph_cache, 0, sizeof (glyph_cache));
status = CAIRO_STATUS_SUCCESS;
for (i = 0; i < info->num_glyphs; i++) {
int x, y;
cairo_image_surface_t *glyph_surface;
cairo_scaled_glyph_t *scaled_glyph;
unsigned long glyph_index = info->glyphs[i].index;
int cache_index = glyph_index % ARRAY_LENGTH (glyph_cache);
scaled_glyph = glyph_cache[cache_index];
if (scaled_glyph == NULL ||
_cairo_scaled_glyph_index (scaled_glyph) != glyph_index)
{
status = _cairo_scaled_glyph_lookup (info->font, glyph_index,
CAIRO_SCALED_GLYPH_INFO_SURFACE,
&scaled_glyph);
if (unlikely (status))
break;
glyph_cache[cache_index] = scaled_glyph;
}
glyph_surface = scaled_glyph->surface;
if (glyph_surface->width && glyph_surface->height) {
/* round glyph locations to the nearest pixel */
/* XXX: FRAGILE: We're ignoring device_transform scaling here. A bug? */
x = _cairo_lround (info->glyphs[i].x -
glyph_surface->base.device_transform.x0);
y = _cairo_lround (info->glyphs[i].y -
glyph_surface->base.device_transform.y0);
pixman_image_composite32 (op, src, glyph_surface->pixman_image, dst,
x + src_x, y + src_y,
0, 0,
x - dst_x, y - dst_y,
glyph_surface->width,
glyph_surface->height);
}
}
return status;
}
| 0
|
204,351
|
bool SQClass::NewSlot(SQSharedState *ss,const SQObjectPtr &key,const SQObjectPtr &val,bool bstatic)
{
SQObjectPtr temp;
bool belongs_to_static_table = sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE || bstatic;
if(_locked && !belongs_to_static_table)
return false; //the class already has an instance so cannot be modified
if(_members->Get(key,temp) && _isfield(temp)) //overrides the default value
{
_defaultvalues[_member_idx(temp)].val = val;
return true;
}
if(belongs_to_static_table) {
SQInteger mmidx;
if((sq_type(val) == OT_CLOSURE || sq_type(val) == OT_NATIVECLOSURE) &&
(mmidx = ss->GetMetaMethodIdxByName(key)) != -1) {
_metamethods[mmidx] = val;
}
else {
SQObjectPtr theval = val;
if(_base && sq_type(val) == OT_CLOSURE) {
theval = _closure(val)->Clone();
_closure(theval)->_base = _base;
__ObjAddRef(_base); //ref for the closure
}
if(sq_type(temp) == OT_NULL) {
bool isconstructor;
SQVM::IsEqual(ss->_constructoridx, key, isconstructor);
if(isconstructor) {
_constructoridx = (SQInteger)_methods.size();
}
SQClassMember m;
m.val = theval;
_members->NewSlot(key,SQObjectPtr(_make_method_idx(_methods.size())));
_methods.push_back(m);
}
else {
_methods[_member_idx(temp)].val = theval;
}
}
return true;
}
SQClassMember m;
m.val = val;
_members->NewSlot(key,SQObjectPtr(_make_field_idx(_defaultvalues.size())));
_defaultvalues.push_back(m);
return true;
}
| 1
|
359,439
|
DEFUN (ip_extcommunity_list_name_expanded,
ip_extcommunity_list_name_expanded_cmd,
"ip extcommunity-list expanded WORD (deny|permit) .LINE",
IP_STR
EXTCOMMUNITY_LIST_STR
"Specify expanded extcommunity-list\n"
"Extended Community list name\n"
"Specify community to reject\n"
"Specify community to accept\n"
"An ordered list as a regular-expression\n")
{
return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
}
| 0
|
247,741
|
TEST_P(SslSocketTest, TicketSessionResumptionDifferentVerifyCertSpki) {
const std::string server_ctx_yaml1 = absl::StrCat(R"EOF(
session_ticket_keys:
keys:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ticket_key_a"
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem"
validation_context:
trusted_ca:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
verify_certificate_spki:
- ")EOF",
TEST_SAN_URI_CERT_SPKI, "\"");
const std::string server_ctx_yaml2 = absl::StrCat(R"EOF(
session_ticket_keys:
keys:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ticket_key_a"
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem"
validation_context:
trusted_ca:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem"
verify_certificate_spki:
- "NvqYIYSbgK2vCJpQhObf77vv+bQWtc5ek5RIOwPiC9A="
- ")EOF",
TEST_SAN_URI_CERT_SPKI, "\"");
const std::string client_ctx_yaml = R"EOF(
common_tls_context:
tls_certificates:
certificate_chain:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem"
private_key:
filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem"
)EOF";
testTicketSessionResumption(server_ctx_yaml1, {}, server_ctx_yaml1, {}, client_ctx_yaml, true,
GetParam());
testTicketSessionResumption(server_ctx_yaml1, {}, server_ctx_yaml2, {}, client_ctx_yaml, false,
GetParam());
}
| 0
|
473,908
|
utf16le_left_adjust_char_head(const UChar* start, const UChar* s, const UChar* end,
OnigEncoding enc ARG_UNUSED)
{
if (s <= start) return (UChar* )s;
if ((s - start) % 2 == 1) {
s--;
}
if (UTF16_IS_SURROGATE_SECOND(*(s+1)) && s > start + 1)
s -= 2;
return (UChar* )s;
}
| 0
|
338,078
|
void WasmBinaryWriter::writeDebugLocation(const Function::DebugLocation& loc) {
if (loc == lastDebugLocation) {
return;
}
auto offset = o.size();
sourceMapLocations.emplace_back(offset, &loc);
lastDebugLocation = loc;
}
| 0
|
385,928
|
long vfs_truncate(struct path *path, loff_t length)
{
struct inode *inode;
long error;
inode = path->dentry->d_inode;
/* For directories it's -EISDIR, for other non-regulars - -EINVAL */
if (S_ISDIR(inode->i_mode))
return -EISDIR;
if (!S_ISREG(inode->i_mode))
return -EINVAL;
error = mnt_want_write(path->mnt);
if (error)
goto out;
error = inode_permission(inode, MAY_WRITE);
if (error)
goto mnt_drop_write_and_out;
error = -EPERM;
if (IS_APPEND(inode))
goto mnt_drop_write_and_out;
error = get_write_access(inode);
if (error)
goto mnt_drop_write_and_out;
/*
* Make sure that there are no leases. get_write_access() protects
* against the truncate racing with a lease-granting setlease().
*/
error = break_lease(inode, O_WRONLY);
if (error)
goto put_write_and_out;
error = locks_verify_truncate(inode, NULL, length);
if (!error)
error = security_path_truncate(path);
if (!error)
error = do_truncate(path->dentry, length, 0, NULL);
put_write_and_out:
put_write_access(inode);
mnt_drop_write_and_out:
mnt_drop_write(path->mnt);
out:
return error;
}
| 0
|
373,538
|
ipf_completed_list_add(struct ovs_list *frag_complete_list,
struct ipf_list *ipf_list)
/* OVS_REQUIRES(ipf_lock) */
{
ovs_list_push_back(frag_complete_list, &ipf_list->list_node);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.