idx
int64 | func
string | target
int64 |
|---|---|---|
179,837
|
void LocalFrameClientImpl::UpdateDocumentLoader(
DocumentLoader* document_loader,
std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) {
static_cast<WebDocumentLoaderImpl*>(document_loader)
->SetExtraData(std::move(extra_data));
}
| 0
|
99,979
|
int keysym2scancode(void *kbd_layout, int keysym)
{
kbd_layout_t *k = kbd_layout;
if (keysym < MAX_NORMAL_KEYCODE) {
if (k->keysym2keycode[keysym] == 0) {
trace_keymap_unmapped(keysym);
fprintf(stderr, "Warning: no scancode found for keysym %d\n",
keysym);
}
return k->keysym2keycode[keysym];
} else {
int i;
#ifdef XK_ISO_Left_Tab
if (keysym == XK_ISO_Left_Tab) {
keysym = XK_Tab;
}
#endif
for (i = 0; i < k->extra_count; i++) {
if (k->keysym2keycode_extra[i].keysym == keysym) {
return k->keysym2keycode_extra[i].keycode;
}
}
}
return 0;
}
| 0
|
330,198
|
static void put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
ptrdiff_t line_size)
{
int i;
/* read the pixels */
for (i = 0; i < 8; i++) {
pixels[0] = av_clip_uint8(block[0]);
pixels[1] = av_clip_uint8(block[1]);
pixels[2] = av_clip_uint8(block[2]);
pixels[3] = av_clip_uint8(block[3]);
pixels[4] = av_clip_uint8(block[4]);
pixels[5] = av_clip_uint8(block[5]);
pixels[6] = av_clip_uint8(block[6]);
pixels[7] = av_clip_uint8(block[7]);
pixels += line_size;
block += 8;
}
}
| 1
|
10,175
|
PrintingContext::Result PrintingContext::AskUserForSettings(
HWND window,
int max_pages,
bool has_selection) {
DCHECK(window);
DCHECK(!in_print_job_);
dialog_box_dismissed_ = false;
PRINTDLGEX dialog_options = { sizeof(PRINTDLGEX) };
dialog_options.hwndOwner = window;
dialog_options.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE |
PD_NOCURRENTPAGE | PD_HIDEPRINTTOFILE;
if (!has_selection)
dialog_options.Flags |= PD_NOSELECTION;
PRINTPAGERANGE ranges[32];
dialog_options.nStartPage = START_PAGE_GENERAL;
if (max_pages) {
memset(ranges, 0, sizeof(ranges));
ranges[0].nFromPage = 1;
ranges[0].nToPage = max_pages;
dialog_options.nPageRanges = 1;
dialog_options.nMaxPageRanges = arraysize(ranges);
dialog_options.nMinPage = 1;
dialog_options.nMaxPage = max_pages;
dialog_options.lpPageRanges = ranges;
} else {
dialog_options.Flags |= PD_NOPAGENUMS;
}
{
if (PrintDlgEx(&dialog_options) != S_OK) {
ResetSettings();
return FAILED;
}
}
return ParseDialogResultEx(dialog_options);
}
| 1
|
360,828
|
gs_manager_set_user_switch_enabled (GSManager *manager,
gboolean user_switch_enabled)
{
g_return_if_fail (GS_IS_MANAGER (manager));
if (manager->priv->user_switch_enabled != user_switch_enabled) {
GSList *l;
manager->priv->user_switch_enabled = user_switch_enabled;
for (l = manager->priv->windows; l; l = l->next) {
gs_window_set_user_switch_enabled (l->data, user_switch_enabled);
}
}
}
| 0
|
63,189
|
snmp_set_var_objid(netsnmp_variable_list * vp,
const oid * objid, size_t name_length)
{
size_t len = sizeof(oid) * name_length;
if (vp->name != vp->name_loc && vp->name != NULL) {
/*
* Probably previously-allocated "big storage". Better free it
* else memory leaks possible.
*/
free(vp->name);
}
/*
* use built-in storage for smaller values
*/
if (len <= sizeof(vp->name_loc)) {
vp->name = vp->name_loc;
} else {
vp->name = (oid *) malloc(len);
if (!vp->name)
return 1;
}
if (objid)
memmove(vp->name, objid, len);
vp->name_length = name_length;
return 0;
}
| 0
|
129,983
|
static void BF_encode(char *dst, const BF_word *src, int size)
{
const unsigned char *sptr = (const unsigned char *)src;
const unsigned char *end = sptr + size;
unsigned char *dptr = (unsigned char *)dst;
unsigned int c1, c2;
do {
c1 = *sptr++;
*dptr++ = BF_itoa64[c1 >> 2];
c1 = (c1 & 0x03) << 4;
if (sptr >= end) {
*dptr++ = BF_itoa64[c1];
break;
}
c2 = *sptr++;
c1 |= c2 >> 4;
*dptr++ = BF_itoa64[c1];
c1 = (c2 & 0x0f) << 2;
if (sptr >= end) {
*dptr++ = BF_itoa64[c1];
break;
}
c2 = *sptr++;
c1 |= c2 >> 6;
*dptr++ = BF_itoa64[c1];
*dptr++ = BF_itoa64[c2 & 0x3f];
} while (sptr < end);
}
| 0
|
346,288
|
xmlNextChar(xmlParserCtxtPtr ctxt)
{
if ((ctxt == NULL) || (ctxt->instate == XML_PARSER_EOF) ||
(ctxt->input == NULL))
return;
if (ctxt->charset == XML_CHAR_ENCODING_UTF8) {
if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0) &&
(ctxt->instate != XML_PARSER_COMMENT)) {
/*
* If we are at the end of the current entity and
* the context allows it, we pop consumed entities
* automatically.
* the auto closing should be blocked in other cases
*/
xmlPopInput(ctxt);
} else {
const unsigned char *cur;
unsigned char c;
/*
* 2.11 End-of-Line Handling
* the literal two-character sequence "#xD#xA" or a standalone
* literal #xD, an XML processor must pass to the application
* the single character #xA.
*/
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++; ctxt->input->col = 1;
} else
ctxt->input->col++;
/*
* We are supposed to handle UTF8, check it's valid
* From rfc2044: encoding of the Unicode values on UTF-8:
*
* UCS-4 range (hex.) UTF-8 octet sequence (binary)
* 0000 0000-0000 007F 0xxxxxxx
* 0000 0080-0000 07FF 110xxxxx 10xxxxxx
* 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
*
* Check for the 0x110000 limit too
*/
cur = ctxt->input->cur;
c = *cur;
if (c & 0x80) {
if (c == 0xC0)
goto encoding_error;
if (cur[1] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if ((cur[1] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xe0) == 0xe0) {
unsigned int val;
if (cur[2] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if ((cur[2] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xf0) == 0xf0) {
if (cur[3] == 0) {
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
cur = ctxt->input->cur;
}
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
/* 4-byte code */
ctxt->input->cur += 4;
val = (cur[0] & 0x7) << 18;
val |= (cur[1] & 0x3f) << 12;
val |= (cur[2] & 0x3f) << 6;
val |= cur[3] & 0x3f;
} else {
/* 3-byte code */
ctxt->input->cur += 3;
val = (cur[0] & 0xf) << 12;
val |= (cur[1] & 0x3f) << 6;
val |= cur[2] & 0x3f;
}
if (((val > 0xd7ff) && (val < 0xe000)) ||
((val > 0xfffd) && (val < 0x10000)) ||
(val >= 0x110000)) {
xmlErrEncodingInt(ctxt, XML_ERR_INVALID_CHAR,
"Char 0x%X out of allowed range\n",
val);
}
} else
/* 2-byte code */
ctxt->input->cur += 2;
} else
/* 1-byte code */
ctxt->input->cur++;
ctxt->nbChars++;
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
} else {
/*
* Assume it's a fixed length encoding (1) with
* a compatible encoding for the ASCII set, since
* XML constructs only use < 128 chars
*/
if (*(ctxt->input->cur) == '\n') {
ctxt->input->line++; ctxt->input->col = 1;
} else
ctxt->input->col++;
ctxt->input->cur++;
ctxt->nbChars++;
if (*ctxt->input->cur == 0)
xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
}
if ((*ctxt->input->cur == '%') && (!ctxt->html))
xmlParserHandlePEReference(ctxt);
if ((*ctxt->input->cur == 0) &&
(xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
xmlPopInput(ctxt);
return;
encoding_error:
/*
* If we detect an UTF8 error that probably mean that the
* input encoding didn't get properly advertised in the
* declaration header. Report the error and switch the encoding
* to ISO-Latin-1 (if you don't like this policy, just declare the
* encoding !)
*/
if ((ctxt == NULL) || (ctxt->input == NULL) ||
(ctxt->input->end - ctxt->input->cur < 4)) {
__xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
"Input is not proper UTF-8, indicate encoding !\n",
NULL, NULL);
} else {
char buffer[150];
snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
ctxt->input->cur[0], ctxt->input->cur[1],
ctxt->input->cur[2], ctxt->input->cur[3]);
__xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
"Input is not proper UTF-8, indicate encoding !\n%s",
BAD_CAST buffer, NULL);
}
ctxt->charset = XML_CHAR_ENCODING_8859_1;
ctxt->input->cur++;
return;
}
| 1
|
323,274
|
static void test_hash_digest(void)
{
size_t i;
g_assert(qcrypto_init(NULL) == 0);
for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
int ret;
char *digest;
size_t digestsize;
digestsize = qcrypto_hash_digest_len(i);
g_assert_cmpint(digestsize * 2, ==, strlen(expected_outputs[i]));
ret = qcrypto_hash_digest(i,
INPUT_TEXT,
strlen(INPUT_TEXT),
&digest,
NULL);
g_assert(ret == 0);
g_assert(g_str_equal(digest, expected_outputs[i]));
g_free(digest);
}
}
| 0
|
97,202
|
GF_ISOMVVCType gf_isom_get_vvc_type(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex)
{
u32 type;
GF_TrackBox *trak;
GF_MPEGVisualSampleEntryBox *entry;
trak = gf_isom_get_track_from_file(the_file, trackNumber);
if (!trak || !trak->Media || !DescriptionIndex) return GF_ISOM_VVCTYPE_NONE;
if (!gf_isom_is_video_handler_type(trak->Media->handler->handlerType))
return GF_ISOM_VVCTYPE_NONE;
entry = (GF_MPEGVisualSampleEntryBox*)gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, DescriptionIndex-1);
if (!entry) return GF_ISOM_VVCTYPE_NONE;
if (entry->internal_type != GF_ISOM_SAMPLE_ENTRY_VIDEO) return GF_ISOM_VVCTYPE_NONE;
type = entry->type;
if (type == GF_ISOM_BOX_TYPE_ENCV) {
GF_ProtectionSchemeInfoBox *sinf = (GF_ProtectionSchemeInfoBox *) gf_isom_box_find_child(entry->child_boxes, GF_ISOM_BOX_TYPE_SINF);
if (sinf && sinf->original_format) type = sinf->original_format->data_format;
}
else if (type == GF_ISOM_BOX_TYPE_RESV) {
if (entry->rinf && entry->rinf->original_format) type = entry->rinf->original_format->data_format;
}
switch (type) {
case GF_ISOM_BOX_TYPE_VVC1:
case GF_ISOM_BOX_TYPE_VVI1:
return GF_ISOM_VVCTYPE_ONLY;
case GF_ISOM_SUBTYPE_VVS1:
return GF_ISOM_VVCTYPE_SUBPIC;
case GF_ISOM_SUBTYPE_VVCN:
return GF_ISOM_VVCTYPE_NVCL;
default:
return GF_ISOM_VVCTYPE_NONE;
}
return GF_ISOM_VVCTYPE_NONE;
}
| 0
|
315,641
|
static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft,
u64 val)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
struct mem_cgroup *parent;
if (val > 100)
return -EINVAL;
if (cgrp->parent == NULL)
return -EINVAL;
parent = mem_cgroup_from_cont(cgrp->parent);
cgroup_lock();
/* If under hierarchy, only empty-root can set this value */
if ((parent->use_hierarchy) ||
(memcg->use_hierarchy && !list_empty(&cgrp->children))) {
cgroup_unlock();
return -EINVAL;
}
memcg->swappiness = val;
cgroup_unlock();
return 0;
}
| 0
|
52,443
|
static void *__netlink_seq_next(struct seq_file *seq)
{
struct nl_seq_iter *iter = seq->private;
struct netlink_sock *nlk;
do {
for (;;) {
int err;
nlk = rhashtable_walk_next(&iter->hti);
if (IS_ERR(nlk)) {
if (PTR_ERR(nlk) == -EAGAIN)
continue;
return nlk;
}
if (nlk)
break;
netlink_walk_stop(iter);
if (++iter->link >= MAX_LINKS)
return NULL;
err = netlink_walk_start(iter);
if (err)
return ERR_PTR(err);
}
} while (sock_net(&nlk->sk) != seq_file_net(seq));
return nlk;
}
| 0
|
255,622
|
writefile(const char *name, struct string *s)
{
FILE *f;
int ret;
f = fopen(name, "w");
if (!f) {
warn("open %s:", name);
return -1;
}
ret = 0;
if (fwrite(s->s, 1, s->n, f) != s->n || fflush(f) != 0) {
warn("write %s:", name);
ret = -1;
}
fclose(f);
return ret;
}
| 1
|
355,462
|
static void check_preempt_wakeup(struct rq *rq, struct task_struct *p)
{
struct task_struct *curr = rq->curr;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
struct sched_entity *se = &curr->se, *pse = &p->se;
unsigned long gran;
if (unlikely(rt_prio(p->prio))) {
update_rq_clock(rq);
update_curr(cfs_rq);
resched_task(curr);
return;
}
cfs_rq_of(pse)->next = pse;
/*
* Batch tasks do not preempt (their preemption is driven by
* the tick):
*/
if (unlikely(p->policy == SCHED_BATCH))
return;
if (!sched_feat(WAKEUP_PREEMPT))
return;
while (!is_same_group(se, pse)) {
se = parent_entity(se);
pse = parent_entity(pse);
}
gran = sysctl_sched_wakeup_granularity;
/*
* More easily preempt - nice tasks, while not making
* it harder for + nice tasks.
*/
if (unlikely(se->load.weight > NICE_0_LOAD))
gran = calc_delta_fair(gran, &se->load);
if (pse->vruntime + gran < se->vruntime)
resched_task(curr);
}
| 0
|
41,921
|
static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
{
__be32 *p;
int status = 0;
*res = 0;
if (unlikely(bitmap[0] & (FATTR4_WORD0_FILES_AVAIL - 1U)))
return -EIO;
if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) {
READ_BUF(8);
READ64(*res);
bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL;
}
dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res);
return status;
}
| 0
|
89,754
|
void Commissioner::HandleMgmtCommissionerSetResponse(void * aContext,
otMessage * aMessage,
const otMessageInfo *aMessageInfo,
otError aResult)
{
static_cast<Commissioner *>(aContext)->HandleMgmtCommissionerSetResponse(
static_cast<Coap::Message *>(aMessage), static_cast<const Ip6::MessageInfo *>(aMessageInfo), aResult);
}
| 0
|
254,337
|
status_t Camera3Device::getInputBufferProducer(
sp<IGraphicBufferProducer> *producer) {
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
if (producer == NULL) {
return BAD_VALUE;
} else if (mInputStream == NULL) {
return INVALID_OPERATION;
}
return mInputStream->getInputBufferProducer(producer);
}
| 0
|
282,517
|
GLenum Framebuffer::GetColorAttachmentFormat() const {
AttachmentMap::const_iterator it = attachments_.find(GL_COLOR_ATTACHMENT0);
if (it == attachments_.end()) {
return 0;
}
const Attachment* attachment = it->second.get();
return attachment->internal_format();
}
| 0
|
219,196
|
WebPlugin* WebLocalFrameImpl::FocusedPluginIfInputMethodSupported() {
WebPluginContainerImpl* container = GetFrame()->GetWebPluginContainer();
if (container && container->SupportsInputMethod())
return container->Plugin();
return 0;
}
| 0
|
50,693
|
//! Convert pixel values from CMY to CMYK color spaces \newinstance.
CImg<Tuchar> get_CMYtoCMYK() const {
if (_spectrum!=3)
throw CImgInstanceException(_cimg_instance
"CMYtoCMYK(): Instance is not a CMY image.",
cimg_instance);
CImg<Tfloat> res(_width,_height,_depth,4);
const T *ps1 = data(0,0,0,0), *ps2 = data(0,0,0,1), *ps3 = data(0,0,0,2);
Tfloat *pd1 = res.data(0,0,0,0), *pd2 = res.data(0,0,0,1), *pd3 = res.data(0,0,0,2), *pd4 = res.data(0,0,0,3);
const longT whd = (longT)width()*height()*depth();
cimg_pragma_openmp(parallel for cimg_openmp_if_size(whd,1024))
for (longT N = 0; N<whd; ++N) {
Tfloat
C = (Tfloat)ps1[N],
M = (Tfloat)ps2[N],
Y = (Tfloat)ps3[N],
K = cimg::min(C,M,Y);
if (K>=255) C = M = Y = 0;
else { const Tfloat K1 = 255 - K; C = 255*(C - K)/K1; M = 255*(M - K)/K1; Y = 255*(Y - K)/K1; }
pd1[N] = (Tfloat)cimg::cut(C,0,255),
pd2[N] = (Tfloat)cimg::cut(M,0,255),
pd3[N] = (Tfloat)cimg::cut(Y,0,255),
pd4[N] = (Tfloat)cimg::cut(K,0,255);
}
return res;
| 0
|
299,788
|
evdns_nameserver_add(unsigned long int address) {
if (!current_base)
current_base = evdns_base_new(NULL, 0);
return evdns_base_nameserver_add(current_base, address);
}
| 0
|
87,787
|
namespace { bool numeric(char c) { return c >= '0' && c <= '9'; } }
| 0
|
215,085
|
static void ucvector_init_buffer(ucvector* p, unsigned char* buffer, size_t size)
{
p->data = buffer;
p->allocsize = p->size = size;
}
| 0
|
204,025
|
void WebContentsAndroid::SetupTransitionView(JNIEnv* env,
jobject jobj,
jstring markup) {
web_contents_->GetMainFrame()->Send(new FrameMsg_SetupTransitionView(
web_contents_->GetMainFrame()->GetRoutingID(),
ConvertJavaStringToUTF8(env, markup)));
}
| 0
|
259,795
|
static void mem_cgroup_destroy(struct cgroup_subsys *ss,
struct cgroup *cont)
{
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
kmem_cgroup_destroy(ss, cont);
mem_cgroup_put(memcg);
}
| 0
|
325,036
|
static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride,
const uint8_t *src, int size, int width, int lines)
{
int i, ret = 0;
int line;
uint8_t *src2 = av_malloc((unsigned)size +
AV_INPUT_BUFFER_PADDING_SIZE);
if (!src2) {
av_log(s->avctx, AV_LOG_ERROR,
"Error allocating temporary buffer\n");
return AVERROR(ENOMEM);
}
if (!s->fill_order) {
memcpy(src2, src, size);
} else {
for (i = 0; i < size; i++)
src2[i] = ff_reverse[src[i]];
}
memset(src2 + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride,
s->compr, s->fax_opts);
if (s->bpp < 8 && s->avctx->pix_fmt == AV_PIX_FMT_PAL8)
for (line = 0; line < lines; line++) {
horizontal_fill(s->bpp, dst, 1, dst, 0, width, 0);
dst += stride;
}
av_free(src2);
return ret;
}
| 1
|
419,873
|
Return a list of subscribed mailboxes */
PHP_FUNCTION(imap_lsub)
{
zval *streamind;
zend_string *ref, *pat;
pils *imap_le_struct;
STRINGLIST *cur=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &ref, &pat) == FAILURE) {
return;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
RETURN_FALSE;
}
/* set flag for normal, old mailbox list */
IMAPG(folderlist_style) = FLIST_ARRAY;
IMAPG(imap_sfolders) = NIL;
mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat));
if (IMAPG(imap_sfolders) == NIL) {
RETURN_FALSE;
}
array_init(return_value);
cur=IMAPG(imap_sfolders);
while (cur != NIL) {
add_next_index_string(return_value, (char*)cur->LTEXT);
cur=cur->next;
}
mail_free_stringlist (&IMAPG(imap_sfolders));
IMAPG(imap_sfolders) = IMAPG(imap_sfolders_tail) = NIL;
| 0
|
364,749
|
httpClientDelayedShutdown(HTTPConnectionPtr connection)
{
TimeEventHandlerPtr handler;
assert(connection->flags & CONN_READER);
handler = scheduleTimeEvent(1, httpClientDelayedShutdownHandler,
sizeof(connection), &connection);
if(!handler) {
do_log(L_ERROR,
"Couldn't schedule delayed shutdown -- freeing memory.");
free_chunk_arenas();
handler = scheduleTimeEvent(1, httpClientDelayedShutdownHandler,
sizeof(connection), &connection);
if(!handler) {
do_log(L_ERROR,
"Couldn't schedule delayed shutdown -- aborting.\n");
polipoExit();
}
}
return 1;
}
| 0
|
50,054
|
static void ion_free_nolock(struct ion_client *client, struct ion_handle *handle)
{
bool valid_handle;
BUG_ON(client != handle->client);
valid_handle = ion_handle_validate(client, handle);
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
return;
}
ion_handle_put_nolock(handle);
}
| 0
|
117,643
|
evdns_config_windows_nameservers(void)
{
if (!current_base) {
current_base = evdns_base_new(NULL, 1);
return current_base == NULL ? -1 : 0;
} else {
return evdns_base_config_windows_nameservers(current_base);
}
}
| 0
|
448,155
|
apr_array_header_t *h2_push_collect_update(h2_stream *stream,
const struct h2_request *req,
const struct h2_headers *res)
{
apr_array_header_t *pushes;
pushes = h2_push_collect(stream->pool, req, stream->push_policy, res);
return h2_push_diary_update(stream->session, pushes);
}
| 0
|
177,861
|
static int tcos_select_file(sc_card_t *card,
const sc_path_t *in_path,
sc_file_t **file_out)
{
sc_context_t *ctx;
sc_apdu_t apdu;
sc_file_t *file=NULL;
u8 buf[SC_MAX_APDU_BUFFER_SIZE], pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;
unsigned int i;
int r, pathlen;
assert(card != NULL && in_path != NULL);
ctx=card->ctx;
memcpy(path, in_path->value, in_path->len);
pathlen = in_path->len;
sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0, 0x04);
switch (in_path->type) {
case SC_PATH_TYPE_FILE_ID:
if (pathlen != 2) return SC_ERROR_INVALID_ARGUMENTS;
/* fall through */
case SC_PATH_TYPE_FROM_CURRENT:
apdu.p1 = 9;
break;
case SC_PATH_TYPE_DF_NAME:
apdu.p1 = 4;
break;
case SC_PATH_TYPE_PATH:
apdu.p1 = 8;
if (pathlen >= 2 && memcmp(path, "\x3F\x00", 2) == 0) path += 2, pathlen -= 2;
if (pathlen == 0) apdu.p1 = 0;
break;
case SC_PATH_TYPE_PARENT:
apdu.p1 = 3;
pathlen = 0;
break;
default:
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_ARGUMENTS);
}
if( pathlen == 0 ) apdu.cse = SC_APDU_CASE_2_SHORT;
apdu.lc = pathlen;
apdu.data = path;
apdu.datalen = pathlen;
if (file_out != NULL) {
apdu.resp = buf;
apdu.resplen = sizeof(buf);
apdu.le = 256;
} else {
apdu.resplen = 0;
apdu.le = 0;
apdu.p2 = 0x0C;
apdu.cse = (pathlen == 0) ? SC_APDU_CASE_1 : SC_APDU_CASE_3_SHORT;
}
r = sc_transmit_apdu(card, &apdu);
SC_TEST_RET(ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
if (r || file_out == NULL) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, r);
if (apdu.resplen < 1 || apdu.resp[0] != 0x62){
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "received invalid template %02X\n", apdu.resp[0]);
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_UNKNOWN_DATA_RECEIVED);
}
file = sc_file_new();
if (file == NULL) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_OUT_OF_MEMORY);
*file_out = file;
file->path = *in_path;
for(i=2; i+1<apdu.resplen && i+1+apdu.resp[i+1]<apdu.resplen; i+=2+apdu.resp[i+1]){
size_t j, len=apdu.resp[i+1];
unsigned char type=apdu.resp[i], *d=apdu.resp+i+2;
switch (type) {
case 0x80:
case 0x81:
file->size=0;
for(j=0; j<len; ++j) file->size = (file->size<<8) | d[j];
break;
case 0x82:
file->shareable = (d[0] & 0x40) ? 1 : 0;
file->ef_structure = d[0] & 7;
switch ((d[0]>>3) & 7) {
case 0: file->type = SC_FILE_TYPE_WORKING_EF; break;
case 7: file->type = SC_FILE_TYPE_DF; break;
default:
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "invalid file type %02X in file descriptor\n", d[0]);
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_UNKNOWN_DATA_RECEIVED);
}
break;
case 0x83:
file->id = (d[0]<<8) | d[1];
break;
case 0x84:
file->namelen = MIN(sizeof file->name, len);
memcpy(file->name, d, file->namelen);
break;
case 0x86:
sc_file_set_sec_attr(file, d, len);
break;
default:
if (len>0) sc_file_set_prop_attr(file, d, len);
}
}
file->magic = SC_FILE_MAGIC;
parse_sec_attr(card, file, file->sec_attr, file->sec_attr_len);
return 0;
}
| 0
|
517,028
|
st_select_lex_node *st_select_lex_node:: insert_chain_before(
st_select_lex_node **ptr_pos_to_insert,
st_select_lex_node *end_chain_node)
{
end_chain_node->link_next= *ptr_pos_to_insert;
(*ptr_pos_to_insert)->link_prev= &end_chain_node->link_next;
this->link_prev= ptr_pos_to_insert;
return this;
}
| 0
|
259,350
|
const std::string& expectedPeerCert() const { return expected_peer_cert_; }
| 0
|
392,817
|
xmlSchemaFree(xmlSchemaPtr schema)
{
if (schema == NULL)
return;
/* @volatiles is not used anymore :-/ */
if (schema->volatiles != NULL)
TODO
/*
* Note that those slots are not responsible for freeing
* schema components anymore; this will now be done by
* the schema buckets.
*/
if (schema->notaDecl != NULL)
xmlHashFree(schema->notaDecl, NULL);
if (schema->attrDecl != NULL)
xmlHashFree(schema->attrDecl, NULL);
if (schema->attrgrpDecl != NULL)
xmlHashFree(schema->attrgrpDecl, NULL);
if (schema->elemDecl != NULL)
xmlHashFree(schema->elemDecl, NULL);
if (schema->typeDecl != NULL)
xmlHashFree(schema->typeDecl, NULL);
if (schema->groupDecl != NULL)
xmlHashFree(schema->groupDecl, NULL);
if (schema->idcDef != NULL)
xmlHashFree(schema->idcDef, NULL);
if (schema->schemasImports != NULL)
xmlHashFree(schema->schemasImports,
(xmlHashDeallocator) xmlSchemaBucketFree);
if (schema->includes != NULL) {
xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes;
int i;
for (i = 0; i < list->nbItems; i++) {
xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]);
}
xmlSchemaItemListFree(list);
}
if (schema->annot != NULL)
xmlSchemaFreeAnnot(schema->annot);
/* Never free the doc here, since this will be done by the buckets. */
xmlDictFree(schema->dict);
xmlFree(schema);
}
| 0
|
463,170
|
ReadWriteType getReadWriteType() const {
return ReadWriteType::kRead;
}
| 0
|
298,255
|
static void sas_unregister_ex_tree(struct asd_sas_port *port, struct domain_device *dev)
{
struct expander_device *ex = &dev->ex_dev;
struct domain_device *child, *n;
list_for_each_entry_safe(child, n, &ex->children, siblings) {
set_bit(SAS_DEV_GONE, &child->state);
if (child->dev_type == SAS_EDGE_EXPANDER_DEVICE ||
child->dev_type == SAS_FANOUT_EXPANDER_DEVICE)
sas_unregister_ex_tree(port, child);
else
sas_unregister_dev(port, child);
}
sas_unregister_dev(port, dev);
}
| 0
|
131,512
|
static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char *ct, unsigned tcount)
{
unsigned long a,b,mask;
for (;;) {
a = *(unsigned long *)cs;
b = load_unaligned_zeropad(ct);
if (tcount < sizeof(unsigned long))
break;
if (unlikely(a != b))
return 1;
cs += sizeof(unsigned long);
ct += sizeof(unsigned long);
tcount -= sizeof(unsigned long);
if (!tcount)
return 0;
}
mask = bytemask_from_count(tcount);
return unlikely(!!((a ^ b) & mask));
}
| 0
|
262,346
|
T& _at(const int offset) {
const unsigned int siz = (unsigned int)size();
return (*this)[offset<0?0:(unsigned int)offset>=siz?siz - 1:offset];
| 0
|
118,802
|
bool JavascriptArray::HasNoMissingValues() const
{
return !!(GetFlags() & DynamicObjectFlags::HasNoMissingValues);
}
| 0
|
297,117
|
int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
struct ib_cm_sidr_req_param *param)
{
struct cm_id_private *cm_id_priv;
struct ib_mad_send_buf *msg;
unsigned long flags;
int ret;
if (!param->path || (param->private_data &&
param->private_data_len > IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE))
return -EINVAL;
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
ret = cm_init_av_by_path(param->path, &cm_id_priv->av);
if (ret)
goto out;
cm_id->service_id = param->service_id;
cm_id->service_mask = ~cpu_to_be64(0);
cm_id_priv->timeout_ms = param->timeout_ms;
cm_id_priv->max_cm_retries = param->max_cm_retries;
ret = cm_alloc_msg(cm_id_priv, &msg);
if (ret)
goto out;
cm_format_sidr_req((struct cm_sidr_req_msg *) msg->mad, cm_id_priv,
param);
msg->timeout_ms = cm_id_priv->timeout_ms;
msg->context[1] = (void *) (unsigned long) IB_CM_SIDR_REQ_SENT;
spin_lock_irqsave(&cm_id_priv->lock, flags);
if (cm_id->state == IB_CM_IDLE)
ret = ib_post_send_mad(msg, NULL);
else
ret = -EINVAL;
if (ret) {
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
cm_free_msg(msg);
goto out;
}
cm_id->state = IB_CM_SIDR_REQ_SENT;
cm_id_priv->msg = msg;
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
out:
return ret;
}
| 0
|
91,439
|
u_update_save_nr(buf_T *buf)
{
u_header_T *uhp;
++buf->b_u_save_nr_last;
buf->b_u_save_nr_cur = buf->b_u_save_nr_last;
uhp = buf->b_u_curhead;
if (uhp != NULL)
uhp = uhp->uh_next.ptr;
else
uhp = buf->b_u_newhead;
if (uhp != NULL)
uhp->uh_save_nr = buf->b_u_save_nr_last;
}
| 0
|
136,990
|
static void intel_pmu_disable_all(void)
{
struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask))
intel_pmu_disable_bts();
intel_pmu_pebs_disable_all();
intel_pmu_lbr_disable_all();
}
| 0
|
277,367
|
void RenderViewTest::SimulatePointClick(const gfx::Point& point) {
WebMouseEvent mouse_event;
mouse_event.type = WebInputEvent::MouseDown;
mouse_event.button = WebMouseEvent::ButtonLeft;
mouse_event.x = point.x();
mouse_event.y = point.y();
mouse_event.clickCount = 1;
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
impl->OnMessageReceived(
InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
mouse_event.type = WebInputEvent::MouseUp;
impl->OnMessageReceived(
InputMsg_HandleInputEvent(0, &mouse_event, ui::LatencyInfo(), false));
}
| 0
|
156,487
|
static MonoBoolean
mono_declsec_get_method_demands_params (MonoMethod *method, MonoDeclSecurityActions* demands,
guint32 id_std, guint32 id_noncas, guint32 id_choice)
{
guint32 idx = mono_method_get_index (method);
idx <<= MONO_HAS_DECL_SECURITY_BITS;
idx |= MONO_HAS_DECL_SECURITY_METHODDEF;
return fill_actions_from_index (method->klass->image, idx, demands, id_std, id_noncas, id_choice);
| 0
|
198,287
|
static int composite_exit(int sub_api)
{
return LIBUSB_SUCCESS;
}
| 0
|
146,303
|
static void test_http_parse(void) {
struct mg_str *v;
struct mg_http_message req;
{
const char *s = "GET / HTTP/1.0\n\n";
ASSERT(mg_http_parse("\b23", 3, &req) == -1);
ASSERT(mg_http_parse("get\n\n", 5, &req) == -1);
ASSERT(mg_http_parse(s, strlen(s) - 1, &req) == 0);
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT(req.message.len == strlen(s));
ASSERT(req.body.len == 0);
}
{
const char *s = "GET /blah HTTP/1.0\r\nFoo: bar \r\n\r\n";
size_t idx, len = strlen(s);
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) len);
ASSERT(mg_vcmp(&req.headers[0].name, "Foo") == 0);
ASSERT(mg_vcmp(&req.headers[0].value, "bar") == 0);
ASSERT(req.headers[1].name.len == 0);
ASSERT(req.headers[1].name.ptr == NULL);
ASSERT(req.query.len == 0);
ASSERT(req.message.len == len);
ASSERT(req.body.len == 0);
for (idx = 0; idx < len; idx++) ASSERT(mg_http_parse(s, idx, &req) == 0);
}
{
static const char *s = "get b c\nz : k \nb: t\nvvv\n\n xx";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s) - 3);
ASSERT(req.headers[2].name.len == 0);
ASSERT(mg_vcmp(&req.headers[0].value, "k") == 0);
ASSERT(mg_vcmp(&req.headers[1].value, "t") == 0);
ASSERT(req.body.len == 0);
}
{
const char *s = "a b c\r\nContent-Length: 21 \r\nb: t\r\nvvv\r\n\r\nabc";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s) - 3);
ASSERT(req.body.len == 21);
ASSERT(req.message.len == 21 - 3 + strlen(s));
ASSERT(mg_http_get_header(&req, "foo") == NULL);
ASSERT((v = mg_http_get_header(&req, "contENT-Length")) != NULL);
ASSERT(mg_vcmp(v, "21") == 0);
ASSERT((v = mg_http_get_header(&req, "B")) != NULL);
ASSERT(mg_vcmp(v, "t") == 0);
}
{
const char *s = "GET /foo?a=b&c=d HTTP/1.0\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT(mg_vcmp(&req.uri, "/foo") == 0);
ASSERT(mg_vcmp(&req.query, "a=b&c=d") == 0);
}
{
const char *s = "POST /x HTTP/1.0\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT(req.body.len == (size_t) ~0);
}
{
const char *s = "WOHOO /x HTTP/1.0\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT(req.body.len == 0);
}
{
const char *s = "HTTP/1.0 200 OK\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT(mg_vcmp(&req.method, "HTTP/1.0") == 0);
ASSERT(mg_vcmp(&req.uri, "200") == 0);
ASSERT(mg_vcmp(&req.proto, "OK") == 0);
ASSERT(req.body.len == (size_t) ~0);
}
{
static const char *s = "HTTP/1.0 999 OMGWTFBBQ\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
}
{
const char *s =
"GET / HTTP/1.0\r\nhost:127.0.0.1:18888\r\nCookie:\r\nX-PlayID: "
"45455\r\nRange: 0-1 \r\n\r\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT((v = mg_http_get_header(&req, "Host")) != NULL);
ASSERT(mg_vcmp(v, "127.0.0.1:18888") == 0);
ASSERT((v = mg_http_get_header(&req, "Cookie")) != NULL);
ASSERT(v->len == 0);
ASSERT((v = mg_http_get_header(&req, "X-PlayID")) != NULL);
ASSERT(mg_vcmp(v, "45455") == 0);
ASSERT((v = mg_http_get_header(&req, "Range")) != NULL);
ASSERT(mg_vcmp(v, "0-1") == 0);
}
{
static const char *s = "a b c\na:1\nb:2\nc:3\nd:4\ne:5\nf:6\ng:7\nh:8\n\n";
ASSERT(mg_http_parse(s, strlen(s), &req) == (int) strlen(s));
ASSERT((v = mg_http_get_header(&req, "e")) != NULL);
ASSERT(mg_vcmp(v, "5") == 0);
ASSERT((v = mg_http_get_header(&req, "h")) == NULL);
}
{
struct mg_connection c;
struct mg_str s,
res = mg_str("GET /\r\nAuthorization: Basic Zm9vOmJhcg==\r\n\r\n");
memset(&c, 0, sizeof(c));
mg_printf(&c, "%s", "GET /\r\n");
mg_http_bauth(&c, "foo", "bar");
mg_printf(&c, "%s", "\r\n");
s = mg_str_n((char *) c.send.buf, c.send.len);
ASSERT(mg_strcmp(s, res) == 0);
mg_iobuf_free(&c.send);
}
{
struct mg_http_message hm;
const char *s = "GET /foo?bar=baz HTTP/1.0\n\n ";
ASSERT(mg_http_parse(s, strlen(s), &hm) == (int) strlen(s) - 1);
ASSERT(mg_strcmp(hm.uri, mg_str("/foo")) == 0);
ASSERT(mg_strcmp(hm.query, mg_str("bar=baz")) == 0);
}
{
struct mg_http_message hm;
const char *s = "a b c\n\n";
ASSERT(mg_http_parse(s, strlen(s), &hm) == (int) strlen(s));
s = "a b\nc\n\n";
ASSERT(mg_http_parse(s, strlen(s), &hm) == (int) strlen(s));
s = "a\nb\nc\n\n";
ASSERT(mg_http_parse(s, strlen(s), &hm) < 0);
}
}
| 0
|
218,212
|
GestureEventConsumeDelegate()
: tap_(false),
tap_down_(false),
tap_cancel_(false),
begin_(false),
end_(false),
scroll_begin_(false),
scroll_update_(false),
scroll_end_(false),
pinch_begin_(false),
pinch_update_(false),
pinch_end_(false),
long_press_(false),
fling_(false),
two_finger_tap_(false),
show_press_(false),
swipe_left_(false),
swipe_right_(false),
swipe_up_(false),
swipe_down_(false),
scroll_x_(0),
scroll_y_(0),
scroll_velocity_x_(0),
scroll_velocity_y_(0),
velocity_x_(0),
velocity_y_(0),
scroll_x_hint_(0),
scroll_y_hint_(0),
tap_count_(0),
flags_(0),
wait_until_event_(ui::ET_UNKNOWN) {}
| 0
|
424,330
|
static void merge_dependencies(Unit *u, Unit *other, const char *other_id, UnitDependency d) {
Iterator i;
Unit *back;
void *v;
int r;
/* Merges all dependencies of type 'd' of the unit 'other' into the deps of the unit 'u' */
assert(u);
assert(other);
assert(d < _UNIT_DEPENDENCY_MAX);
/* Fix backwards pointers. Let's iterate through all dependendent units of the other unit. */
HASHMAP_FOREACH_KEY(v, back, other->dependencies[d], i) {
UnitDependency k;
/* Let's now iterate through the dependencies of that dependencies of the other units, looking for
* pointers back, and let's fix them up, to instead point to 'u'. */
for (k = 0; k < _UNIT_DEPENDENCY_MAX; k++) {
if (back == u) {
/* Do not add dependencies between u and itself. */
if (hashmap_remove(back->dependencies[k], other))
maybe_warn_about_dependency(u, other_id, k);
} else {
UnitDependencyInfo di_u, di_other, di_merged;
/* Let's drop this dependency between "back" and "other", and let's create it between
* "back" and "u" instead. Let's merge the bit masks of the dependency we are moving,
* and any such dependency which might already exist */
di_other.data = hashmap_get(back->dependencies[k], other);
if (!di_other.data)
continue; /* dependency isn't set, let's try the next one */
di_u.data = hashmap_get(back->dependencies[k], u);
di_merged = (UnitDependencyInfo) {
.origin_mask = di_u.origin_mask | di_other.origin_mask,
.destination_mask = di_u.destination_mask | di_other.destination_mask,
};
r = hashmap_remove_and_replace(back->dependencies[k], other, u, di_merged.data);
if (r < 0)
log_warning_errno(r, "Failed to remove/replace: back=%s other=%s u=%s: %m", back->id, other_id, u->id);
assert(r >= 0);
/* assert_se(hashmap_remove_and_replace(back->dependencies[k], other, u, di_merged.data) >= 0); */
}
}
}
/* Also do not move dependencies on u to itself */
back = hashmap_remove(other->dependencies[d], u);
if (back)
maybe_warn_about_dependency(u, other_id, d);
/* The move cannot fail. The caller must have performed a reservation. */
assert_se(hashmap_complete_move(&u->dependencies[d], &other->dependencies[d]) == 0);
other->dependencies[d] = hashmap_free(other->dependencies[d]);
}
| 0
|
99,851
|
int ToTraditional_ex(byte* input, word32 sz, word32* algId)
{
word32 inOutIdx = 0;
int length;
if (input == NULL)
return BAD_FUNC_ARG;
length = ToTraditionalInline_ex(input, &inOutIdx, sz, algId);
if (length < 0)
return length;
if (length + inOutIdx > sz)
return BUFFER_E;
XMEMMOVE(input, input + inOutIdx, length);
return length;
}
| 0
|
41,611
|
void free_hist_patterns()
{
delete_dynamic(&histignore_patterns);
}
| 0
|
149,012
|
kadm5_create_principal_3(void *server_handle,
kadm5_principal_ent_t entry, long mask,
int n_ks_tuple, krb5_key_salt_tuple *ks_tuple,
char *password)
{
krb5_db_entry *kdb;
osa_princ_ent_rec adb;
kadm5_policy_ent_rec polent;
krb5_boolean have_polent = FALSE;
krb5_int32 now;
krb5_tl_data *tl_data_tail;
unsigned int ret;
kadm5_server_handle_t handle = server_handle;
krb5_keyblock *act_mkey;
krb5_kvno act_kvno;
int new_n_ks_tuple = 0;
krb5_key_salt_tuple *new_ks_tuple = NULL;
CHECK_HANDLE(server_handle);
krb5_clear_error_message(handle->context);
check_1_6_dummy(entry, mask, n_ks_tuple, ks_tuple, &password);
/*
* Argument sanity checking, and opening up the DB
*/
if (entry == NULL)
return EINVAL;
if(!(mask & KADM5_PRINCIPAL) || (mask & KADM5_MOD_NAME) ||
(mask & KADM5_MOD_TIME) || (mask & KADM5_LAST_PWD_CHANGE) ||
(mask & KADM5_MKVNO) || (mask & KADM5_AUX_ATTRIBUTES) ||
(mask & KADM5_LAST_SUCCESS) || (mask & KADM5_LAST_FAILED) ||
(mask & KADM5_FAIL_AUTH_COUNT))
return KADM5_BAD_MASK;
if ((mask & KADM5_KEY_DATA) && entry->n_key_data != 0)
return KADM5_BAD_MASK;
if((mask & KADM5_POLICY) && entry->policy == NULL)
return KADM5_BAD_MASK;
if((mask & KADM5_POLICY) && (mask & KADM5_POLICY_CLR))
return KADM5_BAD_MASK;
if((mask & ~ALL_PRINC_MASK))
return KADM5_BAD_MASK;
/*
* Check to see if the principal exists
*/
ret = kdb_get_entry(handle, entry->principal, &kdb, &adb);
switch(ret) {
case KADM5_UNK_PRINC:
break;
case 0:
kdb_free_entry(handle, kdb, &adb);
return KADM5_DUP;
default:
return ret;
}
kdb = krb5_db_alloc(handle->context, NULL, sizeof(*kdb));
if (kdb == NULL)
return ENOMEM;
memset(kdb, 0, sizeof(*kdb));
memset(&adb, 0, sizeof(osa_princ_ent_rec));
/*
* If a policy was specified, load it.
* If we can not find the one specified return an error
*/
if ((mask & KADM5_POLICY)) {
ret = get_policy(handle, entry->policy, &polent, &have_polent);
if (ret)
goto cleanup;
}
if (password) {
ret = passwd_check(handle, password, have_polent ? &polent : NULL,
entry->principal);
if (ret)
goto cleanup;
}
/*
* Start populating the various DB fields, using the
* "defaults" for fields that were not specified by the
* mask.
*/
if ((ret = krb5_timeofday(handle->context, &now)))
goto cleanup;
kdb->magic = KRB5_KDB_MAGIC_NUMBER;
kdb->len = KRB5_KDB_V1_BASE_LENGTH; /* gag me with a chainsaw */
if ((mask & KADM5_ATTRIBUTES))
kdb->attributes = entry->attributes;
else
kdb->attributes = handle->params.flags;
if ((mask & KADM5_MAX_LIFE))
kdb->max_life = entry->max_life;
else
kdb->max_life = handle->params.max_life;
if (mask & KADM5_MAX_RLIFE)
kdb->max_renewable_life = entry->max_renewable_life;
else
kdb->max_renewable_life = handle->params.max_rlife;
if ((mask & KADM5_PRINC_EXPIRE_TIME))
kdb->expiration = entry->princ_expire_time;
else
kdb->expiration = handle->params.expiration;
kdb->pw_expiration = 0;
if (have_polent) {
if(polent.pw_max_life)
kdb->pw_expiration = now + polent.pw_max_life;
else
kdb->pw_expiration = 0;
}
if ((mask & KADM5_PW_EXPIRATION))
kdb->pw_expiration = entry->pw_expiration;
kdb->last_success = 0;
kdb->last_failed = 0;
kdb->fail_auth_count = 0;
/* this is kind of gross, but in order to free the tl data, I need
to free the entire kdb entry, and that will try to free the
principal. */
if ((ret = kadm5_copy_principal(handle->context,
entry->principal, &(kdb->princ))))
goto cleanup;
if ((ret = krb5_dbe_update_last_pwd_change(handle->context, kdb, now)))
goto cleanup;
if (mask & KADM5_TL_DATA) {
/* splice entry->tl_data onto the front of kdb->tl_data */
for (tl_data_tail = entry->tl_data; tl_data_tail;
tl_data_tail = tl_data_tail->tl_data_next)
{
ret = krb5_dbe_update_tl_data(handle->context, kdb, tl_data_tail);
if( ret )
goto cleanup;
}
}
/*
* We need to have setup the TL data, so we have strings, so we can
* check enctype policy, which is why we check/initialize ks_tuple
* this late.
*/
ret = apply_keysalt_policy(handle, entry->policy, n_ks_tuple, ks_tuple,
&new_n_ks_tuple, &new_ks_tuple);
if (ret)
goto cleanup;
/* initialize the keys */
ret = kdb_get_active_mkey(handle, &act_kvno, &act_mkey);
if (ret)
goto cleanup;
if (mask & KADM5_KEY_DATA) {
/* The client requested no keys for this principal. */
assert(entry->n_key_data == 0);
} else if (password) {
ret = krb5_dbe_cpw(handle->context, act_mkey, new_ks_tuple,
new_n_ks_tuple, password,
(mask & KADM5_KVNO)?entry->kvno:1,
FALSE, kdb);
} else {
/* Null password means create with random key (new in 1.8). */
ret = krb5_dbe_crk(handle->context, &master_keyblock,
new_ks_tuple, new_n_ks_tuple, FALSE, kdb);
}
if (ret)
goto cleanup;
/* Record the master key VNO used to encrypt this entry's keys */
ret = krb5_dbe_update_mkvno(handle->context, kdb, act_kvno);
if (ret)
goto cleanup;
ret = k5_kadm5_hook_create(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_PRECOMMIT, entry, mask,
new_n_ks_tuple, new_ks_tuple, password);
if (ret)
goto cleanup;
/* populate the admin-server-specific fields. In the OV server,
this used to be in a separate database. Since there's already
marshalling code for the admin fields, to keep things simple,
I'm going to keep it, and make all the admin stuff occupy a
single tl_data record, */
adb.admin_history_kvno = INITIAL_HIST_KVNO;
if (mask & KADM5_POLICY) {
adb.aux_attributes = KADM5_POLICY;
/* this does *not* need to be strdup'ed, because adb is xdr */
/* encoded in osa_adb_create_princ, and not ever freed */
adb.policy = entry->policy;
}
/* In all cases key and the principal data is set, let the database provider know */
kdb->mask = mask | KADM5_KEY_DATA | KADM5_PRINCIPAL ;
/* store the new db entry */
ret = kdb_put_entry(handle, kdb, &adb);
(void) k5_kadm5_hook_create(handle->context, handle->hook_handles,
KADM5_HOOK_STAGE_POSTCOMMIT, entry, mask,
new_n_ks_tuple, new_ks_tuple, password);
cleanup:
free(new_ks_tuple);
krb5_db_free_principal(handle->context, kdb);
if (have_polent)
(void) kadm5_free_policy_ent(handle->lhandle, &polent);
return ret;
}
| 0
|
415,731
|
flags(void)
{
unsigned long flags;
gfp_t gfp;
char *cmp_buffer;
flags = 0;
test("", "%pGp", &flags);
/* Page flags should filter the zone id */
flags = 1UL << NR_PAGEFLAGS;
test("", "%pGp", &flags);
flags |= 1UL << PG_uptodate | 1UL << PG_dirty | 1UL << PG_lru
| 1UL << PG_active | 1UL << PG_swapbacked;
test("uptodate|dirty|lru|active|swapbacked", "%pGp", &flags);
flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC
| VM_DENYWRITE;
test("read|exec|mayread|maywrite|mayexec|denywrite", "%pGv", &flags);
gfp = GFP_TRANSHUGE;
test("GFP_TRANSHUGE", "%pGg", &gfp);
gfp = GFP_ATOMIC|__GFP_DMA;
test("GFP_ATOMIC|GFP_DMA", "%pGg", &gfp);
gfp = __GFP_ATOMIC;
test("__GFP_ATOMIC", "%pGg", &gfp);
cmp_buffer = kmalloc(BUF_SIZE, GFP_KERNEL);
if (!cmp_buffer)
return;
/* Any flags not translated by the table should remain numeric */
gfp = ~__GFP_BITS_MASK;
snprintf(cmp_buffer, BUF_SIZE, "%#lx", (unsigned long) gfp);
test(cmp_buffer, "%pGg", &gfp);
snprintf(cmp_buffer, BUF_SIZE, "__GFP_ATOMIC|%#lx",
(unsigned long) gfp);
gfp |= __GFP_ATOMIC;
test(cmp_buffer, "%pGg", &gfp);
kfree(cmp_buffer);
}
| 0
|
64,154
|
static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct net_device *dev = info->user_ptr[1];
struct bss_parameters params;
memset(¶ms, 0, sizeof(params));
/* default to not changing parameters */
params.use_cts_prot = -1;
params.use_short_preamble = -1;
params.use_short_slot_time = -1;
params.ap_isolate = -1;
params.ht_opmode = -1;
if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
params.use_cts_prot =
nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]);
if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE])
params.use_short_preamble =
nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]);
if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
params.use_short_slot_time =
nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
params.basic_rates =
nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
params.basic_rates_len =
nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
}
if (info->attrs[NL80211_ATTR_AP_ISOLATE])
params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]);
if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE])
params.ht_opmode =
nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]);
if (!rdev->ops->change_bss)
return -EOPNOTSUPP;
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
return -EOPNOTSUPP;
return rdev->ops->change_bss(&rdev->wiphy, dev, ¶ms);
}
| 0
|
269,753
|
static bool arg_type_is_alloc_mem_ptr(enum bpf_arg_type type)
{
return type == ARG_PTR_TO_ALLOC_MEM ||
type == ARG_PTR_TO_ALLOC_MEM_OR_NULL;
}
| 0
|
114,760
|
SPL_METHOD(Array, offsetSet)
{
zval *index, *value;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &index, &value) == FAILURE) {
return;
}
spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC);
} /* }}} */
| 0
|
265,457
|
static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net)
{
}
| 0
|
379,181
|
static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
array_init(&EX_T(opline->result.u.var).tmp_var);
if (IS_CV == IS_UNUSED) {
ZEND_VM_NEXT_OPCODE();
#if 0 || IS_CV != IS_UNUSED
} else {
return ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
#endif
}
}
| 0
|
414,839
|
process_set_cookie_header (SoupMessage *msg, gpointer user_data)
{
SoupCookieJar *jar = user_data;
SoupCookieJarPrivate *priv = soup_cookie_jar_get_instance_private (jar);
GSList *new_cookies, *nc;
if (priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NEVER)
return;
new_cookies = soup_cookies_from_response (msg);
for (nc = new_cookies; nc; nc = nc->next) {
SoupURI *first_party = soup_message_get_first_party (msg);
if ((priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY &&
!incoming_cookie_is_third_party (nc->data, first_party)) ||
priv->accept_policy == SOUP_COOKIE_JAR_ACCEPT_ALWAYS)
soup_cookie_jar_add_cookie (jar, nc->data);
else
soup_cookie_free (nc->data);
}
g_slist_free (new_cookies);
}
| 0
|
270,071
|
vma_address(struct page *page, struct vm_area_struct *vma)
{
unsigned long address = __vma_address(page, vma);
/* page should be within @vma mapping range */
VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end);
return address;
}
| 0
|
94,999
|
repodata_setpos_kv(Repodata *data, KeyValue *kv)
{
Pool *pool = data->repo->pool;
if (!kv)
pool_clear_pos(pool);
else
{
pool->pos.repo = data->repo;
pool->pos.repodataid = data - data->repo->repodata;
pool->pos.dp = (unsigned char *)kv->str - data->incoredata;
pool->pos.schema = kv->id;
}
}
| 0
|
286,057
|
ProcSetFontPath(ClientPtr client)
{
unsigned char *ptr;
unsigned long nbytes, total;
long nfonts;
int n;
REQUEST(xSetFontPathReq);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
total = nbytes;
ptr = (unsigned char *) &stuff[1];
nfonts = stuff->nFonts;
while (--nfonts >= 0) {
if ((total == 0) || (total < (n = (*ptr + 1))))
return BadLength;
total -= n;
ptr += n;
}
if (total >= 4)
return BadLength;
return SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
}
| 0
|
479,966
|
evdev_scroll_set_button_lock(struct libinput_device *device,
enum libinput_config_scroll_button_lock_state state)
{
struct evdev_device *evdev = evdev_device(device);
switch (state) {
case LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED:
evdev->scroll.want_lock_enabled = false;
break;
case LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED:
evdev->scroll.want_lock_enabled = true;
break;
default:
return LIBINPUT_CONFIG_STATUS_INVALID;
}
evdev->scroll.change_scroll_method(evdev);
return LIBINPUT_CONFIG_STATUS_SUCCESS;
}
| 0
|
142,176
|
static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
{
struct inode *inode = ordered_extent->inode;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans = NULL;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct extent_state *cached_state = NULL;
struct new_sa_defrag_extent *new = NULL;
int compress_type = 0;
int ret = 0;
u64 logical_len = ordered_extent->len;
bool nolock;
bool truncated = false;
nolock = btrfs_is_free_space_inode(inode);
if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
ret = -EIO;
goto out;
}
btrfs_free_io_failure_record(inode, ordered_extent->file_offset,
ordered_extent->file_offset +
ordered_extent->len - 1);
if (test_bit(BTRFS_ORDERED_TRUNCATED, &ordered_extent->flags)) {
truncated = true;
logical_len = ordered_extent->truncated_len;
/* Truncated the entire extent, don't bother adding */
if (!logical_len)
goto out;
}
if (test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags)) {
BUG_ON(!list_empty(&ordered_extent->list)); /* Logic error */
btrfs_ordered_update_i_size(inode, 0, ordered_extent);
if (nolock)
trans = btrfs_join_transaction_nolock(root);
else
trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
trans = NULL;
goto out;
}
trans->block_rsv = &root->fs_info->delalloc_block_rsv;
ret = btrfs_update_inode_fallback(trans, root, inode);
if (ret) /* -ENOMEM or corruption */
btrfs_abort_transaction(trans, root, ret);
goto out;
}
lock_extent_bits(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1,
0, &cached_state);
ret = test_range_bit(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1,
EXTENT_DEFRAG, 1, cached_state);
if (ret) {
u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item);
if (0 && last_snapshot >= BTRFS_I(inode)->generation)
/* the inode is shared */
new = record_old_file_extents(inode, ordered_extent);
clear_extent_bit(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset + ordered_extent->len - 1,
EXTENT_DEFRAG, 0, 0, &cached_state, GFP_NOFS);
}
if (nolock)
trans = btrfs_join_transaction_nolock(root);
else
trans = btrfs_join_transaction(root);
if (IS_ERR(trans)) {
ret = PTR_ERR(trans);
trans = NULL;
goto out_unlock;
}
trans->block_rsv = &root->fs_info->delalloc_block_rsv;
if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered_extent->flags))
compress_type = ordered_extent->compress_type;
if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags)) {
BUG_ON(compress_type);
ret = btrfs_mark_extent_written(trans, inode,
ordered_extent->file_offset,
ordered_extent->file_offset +
logical_len);
} else {
BUG_ON(root == root->fs_info->tree_root);
ret = insert_reserved_file_extent(trans, inode,
ordered_extent->file_offset,
ordered_extent->start,
ordered_extent->disk_len,
logical_len, logical_len,
compress_type, 0, 0,
BTRFS_FILE_EXTENT_REG);
if (!ret)
btrfs_release_delalloc_bytes(root,
ordered_extent->start,
ordered_extent->disk_len);
}
unpin_extent_cache(&BTRFS_I(inode)->extent_tree,
ordered_extent->file_offset, ordered_extent->len,
trans->transid);
if (ret < 0) {
btrfs_abort_transaction(trans, root, ret);
goto out_unlock;
}
add_pending_csums(trans, inode, ordered_extent->file_offset,
&ordered_extent->list);
btrfs_ordered_update_i_size(inode, 0, ordered_extent);
ret = btrfs_update_inode_fallback(trans, root, inode);
if (ret) { /* -ENOMEM or corruption */
btrfs_abort_transaction(trans, root, ret);
goto out_unlock;
}
ret = 0;
out_unlock:
unlock_extent_cached(io_tree, ordered_extent->file_offset,
ordered_extent->file_offset +
ordered_extent->len - 1, &cached_state, GFP_NOFS);
out:
if (root != root->fs_info->tree_root)
btrfs_delalloc_release_metadata(inode, ordered_extent->len);
if (trans)
btrfs_end_transaction(trans, root);
if (ret || truncated) {
u64 start, end;
if (truncated)
start = ordered_extent->file_offset + logical_len;
else
start = ordered_extent->file_offset;
end = ordered_extent->file_offset + ordered_extent->len - 1;
clear_extent_uptodate(io_tree, start, end, NULL, GFP_NOFS);
/* Drop the cache for the part of the extent we didn't write. */
btrfs_drop_extent_cache(inode, start, end, 0);
/*
* If the ordered extent had an IOERR or something else went
* wrong we need to return the space for this ordered extent
* back to the allocator. We only free the extent in the
* truncated case if we didn't write out the extent at all.
*/
if ((ret || !logical_len) &&
!test_bit(BTRFS_ORDERED_NOCOW, &ordered_extent->flags) &&
!test_bit(BTRFS_ORDERED_PREALLOC, &ordered_extent->flags))
btrfs_free_reserved_extent(root, ordered_extent->start,
ordered_extent->disk_len, 1);
}
/*
* This needs to be done to make sure anybody waiting knows we are done
* updating everything for this ordered extent.
*/
btrfs_remove_ordered_extent(inode, ordered_extent);
/* for snapshot-aware defrag */
if (new) {
if (ret) {
free_sa_defrag_extent(new);
atomic_dec(&root->fs_info->defrag_running);
} else {
relink_file_extents(new);
}
}
/* once for us */
btrfs_put_ordered_extent(ordered_extent);
/* once for the tree */
btrfs_put_ordered_extent(ordered_extent);
return ret;
}
| 0
|
35,849
|
static int rtnl_net_get_size(void)
{
return NLMSG_ALIGN(sizeof(struct rtgenmsg))
+ nla_total_size(sizeof(s32)) /* NETNSA_NSID */
+ nla_total_size(sizeof(s32)) /* NETNSA_CURRENT_NSID */
;
}
| 0
|
143,078
|
void stsz_box_del(GF_Box *s)
{
GF_SampleSizeBox *ptr = (GF_SampleSizeBox *)s;
if (ptr == NULL) return;
if (ptr->sizes) gf_free(ptr->sizes);
gf_free(ptr);
}
| 0
|
149,442
|
static TensorBuffer* Decode(Allocator* a, const Source& in, int64_t n) {
auto* buf = new Buffer<ResourceHandle>(a, n);
ResourceHandle* ps = buf->template base<ResourceHandle>();
if (ps == nullptr ||
!DecodeResourceHandleList(port::NewStringListDecoder(in), ps, n)) {
buf->Unref();
return nullptr;
}
return buf;
}
| 0
|
354,160
|
bool Virtual_column_info::fix_session_expr(THD *thd)
{
DBUG_ENTER("fix_session_vcol_expr");
if (!(flags & (VCOL_TIME_FUNC|VCOL_SESSION_FUNC)))
DBUG_RETURN(0);
expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0);
DBUG_ASSERT(!expr->fixed);
DBUG_RETURN(fix_expr(thd));
}
| 1
|
420,277
|
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
|
230,766
|
void HTMLMediaElement::enterPictureInPicture(
WebMediaPlayer::PipWindowSizeCallback callback) {
if (GetWebMediaPlayer())
GetWebMediaPlayer()->EnterPictureInPicture(std::move(callback));
}
| 0
|
269,353
|
static int vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct page *page;
page = vmalloc_to_page((void *)(vmf->pgoff << PAGE_SHIFT));
if (!page)
return VM_FAULT_SIGBUS;
get_page(page);
vmf->page = page;
return 0;
}
| 0
|
143,392
|
uint32_t BinaryProtocolWriter::serializedSizeMapBegin(
TType /*keyType*/,
TType /*valType*/,
uint32_t /*size*/) const {
return serializedSizeByte() + serializedSizeByte() + serializedSizeI32();
}
| 0
|
352,707
|
ArgParser::argOiMinArea(char* parameter)
{
o.oi_min_area = QUtil::string_to_int(parameter);
}
| 1
|
250,069
|
rc_pdf14_maskbuf_free(gs_memory_t * mem, void *ptr_in, client_name_t cname)
{
/* Ending the mask buffer. */
pdf14_rcmask_t *rcmask = (pdf14_rcmask_t * ) ptr_in;
/* free the pdf14 buffer. */
if ( rcmask->mask_buf != NULL ){
pdf14_buf_free(rcmask->mask_buf, mem);
}
gs_free_object(mem, rcmask, "rc_pdf14_maskbuf_free");
}
| 0
|
417,732
|
int link_set_hostname(Link *link, const char *hostname) {
int r;
assert(link);
assert(link->manager);
log_link_debug(link, "Setting transient hostname: '%s'", strna(hostname));
if (!link->manager->bus) {
/* TODO: replace by assert when we can rely on kdbus */
log_link_info(link, "Not connected to system bus, ignoring transient hostname.");
return 0;
}
r = sd_bus_call_method_async(
link->manager->bus,
NULL,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
"org.freedesktop.hostname1",
"SetHostname",
set_hostname_handler,
link,
"sb",
hostname,
false);
if (r < 0)
return log_link_error_errno(link, r, "Could not set transient hostname: %m");
link_ref(link);
return 0;
}
| 0
|
295,539
|
iperf_reporter_callback(struct iperf_test *test)
{
switch (test->state) {
case TEST_RUNNING:
case STREAM_RUNNING:
/* print interval results for each stream */
iperf_print_intermediate(test);
break;
case TEST_END:
case DISPLAY_RESULTS:
iperf_print_intermediate(test);
iperf_print_results(test);
break;
}
}
| 0
|
129,035
|
TEST_F(AllowMissingInAndOfOrListTest, OneGoodJwt) {
EXPECT_CALL(mock_cb_, onComplete(Status::Ok));
auto headers = Http::TestRequestHeaderMapImpl{{kExampleHeader, GoodToken}};
context_ = Verifier::createContext(headers, parent_span_, &mock_cb_);
verifier_->verify(context_);
EXPECT_THAT(headers, JwtOutputSuccess(kExampleHeader));
}
| 0
|
114,789
|
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteConvParams*>(node->builtin_data);
const TfLiteEvalTensor* input =
tflite::micro::GetEvalInput(context, node, kInputTensor);
const TfLiteEvalTensor* filter =
tflite::micro::GetEvalInput(context, node, kFilterTensor);
const TfLiteEvalTensor* bias =
(NumInputs(node) == 3)
? tflite::micro::GetEvalInput(context, node, kBiasTensor)
: nullptr;
TfLiteEvalTensor* output =
tflite::micro::GetEvalOutput(context, node, kOutputTensor);
TFLITE_DCHECK(node->user_data != nullptr);
const OpData& data = *(static_cast<const OpData*>(node->user_data));
switch (input->type) { // Already know in/out types are same.
case kTfLiteFloat32:
EvalFloat(context, node, params, data, input, filter, bias, nullptr,
nullptr, output);
break;
case kTfLiteInt8:
EvalQuantizedPerChannel(context, node, params, data, input, filter, bias,
output, nullptr);
break;
case kTfLiteUInt8:
EvalQuantized(context, node, params, data, input, filter, bias, nullptr,
nullptr, output);
break;
default:
TF_LITE_KERNEL_LOG(context, "Type %s (%d) not supported.",
TfLiteTypeGetName(input->type), input->type);
return kTfLiteError;
}
return kTfLiteOk;
}
| 0
|
357,147
|
void __scm_destroy(struct scm_cookie *scm)
{
struct scm_fp_list *fpl = scm->fp;
int i;
if (fpl) {
scm->fp = NULL;
if (current->scm_work_list) {
list_add_tail(&fpl->list, current->scm_work_list);
} else {
LIST_HEAD(work_list);
current->scm_work_list = &work_list;
list_add(&fpl->list, &work_list);
while (!list_empty(&work_list)) {
fpl = list_first_entry(&work_list, struct scm_fp_list, list);
list_del(&fpl->list);
for (i=fpl->count-1; i>=0; i--)
fput(fpl->fp[i]);
kfree(fpl);
}
current->scm_work_list = NULL;
}
}
}
| 0
|
295,655
|
load_list(UnpicklerObject *self)
{
PyObject *list;
Py_ssize_t i;
if ((i = marker(self)) < 0)
return -1;
list = Pdata_poplist(self->stack, i);
if (list == NULL)
return -1;
PDATA_PUSH(self->stack, list, -1);
return 0;
}
| 0
|
495,485
|
njs_string_create(njs_vm_t *vm, njs_value_t *value, const char *src,
size_t size)
{
njs_str_t str;
str.start = (u_char *) src;
str.length = size;
return njs_string_decode_utf8(vm, value, &str);
}
| 0
|
214,367
|
WebDriverCommand::~WebDriverCommand() {}
| 0
|
42,631
|
static void ReadBlobDoublesMSB(Image * image, size_t len, double *data)
{
while (len >= 8)
{
*data++ = ReadBlobDouble(image);
len -= sizeof(double);
}
if (len > 0)
(void) SeekBlob(image, len, SEEK_CUR);
}
| 0
|
465,965
|
static bool cpu_has_sgx(void)
{
return cpuid_eax(0) >= 0x12 && (cpuid_eax(0x12) & BIT(0));
}
| 0
|
298,450
|
static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs,
void *pBuf, size_t n) {
mz_zip_archive *pZip = (mz_zip_archive *)pOpaque;
size_t s = (file_ofs >= pZip->m_archive_size)
? 0
: (size_t)MZ_MIN(pZip->m_archive_size - file_ofs, n);
memcpy(pBuf, (const mz_uint8 *)pZip->m_pState->m_pMem + file_ofs, s);
return s;
}
| 0
|
202,971
|
static int mem_control_numa_stat_show(struct seq_file *m, void *arg)
{
int nid;
unsigned long total_nr, file_nr, anon_nr, unevictable_nr;
unsigned long node_nr;
struct cgroup *cont = m->private;
struct mem_cgroup *mem_cont = mem_cgroup_from_cont(cont);
total_nr = mem_cgroup_nr_lru_pages(mem_cont, LRU_ALL);
seq_printf(m, "total=%lu", total_nr);
for_each_node_state(nid, N_HIGH_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(mem_cont, nid, LRU_ALL);
seq_printf(m, " N%d=%lu", nid, node_nr);
}
seq_putc(m, '\n');
file_nr = mem_cgroup_nr_lru_pages(mem_cont, LRU_ALL_FILE);
seq_printf(m, "file=%lu", file_nr);
for_each_node_state(nid, N_HIGH_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(mem_cont, nid,
LRU_ALL_FILE);
seq_printf(m, " N%d=%lu", nid, node_nr);
}
seq_putc(m, '\n');
anon_nr = mem_cgroup_nr_lru_pages(mem_cont, LRU_ALL_ANON);
seq_printf(m, "anon=%lu", anon_nr);
for_each_node_state(nid, N_HIGH_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(mem_cont, nid,
LRU_ALL_ANON);
seq_printf(m, " N%d=%lu", nid, node_nr);
}
seq_putc(m, '\n');
unevictable_nr = mem_cgroup_nr_lru_pages(mem_cont, BIT(LRU_UNEVICTABLE));
seq_printf(m, "unevictable=%lu", unevictable_nr);
for_each_node_state(nid, N_HIGH_MEMORY) {
node_nr = mem_cgroup_node_nr_lru_pages(mem_cont, nid,
BIT(LRU_UNEVICTABLE));
seq_printf(m, " N%d=%lu", nid, node_nr);
}
seq_putc(m, '\n');
return 0;
}
| 0
|
71,453
|
enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream)
{
enum dc_status status = DC_OK;
struct pipe_ctx *pipe_ctx = resource_get_head_pipe_for_stream(&context->res_ctx, stream);
/*TODO Seems unneeded anymore */
/* if (old_context && resource_is_stream_unchanged(old_context, stream)) {
if (stream != NULL && old_context->streams[i] != NULL) {
todo: shouldn't have to copy missing parameter here
resource_build_bit_depth_reduction_params(stream,
&stream->bit_depth_params);
stream->clamping.pixel_encoding =
stream->timing.pixel_encoding;
resource_build_bit_depth_reduction_params(stream,
&stream->bit_depth_params);
build_clamping_params(stream);
continue;
}
}
*/
if (!pipe_ctx)
return DC_ERROR_UNEXPECTED;
status = build_pipe_hw_param(pipe_ctx);
return status;
}
| 0
|
454,809
|
int rtas_call_reentrant(int token, int nargs, int nret, int *outputs, ...)
{
va_list list;
struct rtas_args *args;
unsigned long flags;
int i, ret = 0;
if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
return -1;
local_irq_save(flags);
preempt_disable();
/* We use the per-cpu (PACA) rtas args buffer */
args = local_paca->rtas_args_reentrant;
va_start(list, outputs);
va_rtas_call_unlocked(args, token, nargs, nret, list);
va_end(list);
if (nret > 1 && outputs)
for (i = 0; i < nret - 1; ++i)
outputs[i] = be32_to_cpu(args->rets[i + 1]);
if (nret > 0)
ret = be32_to_cpu(args->rets[0]);
local_irq_restore(flags);
preempt_enable();
return ret;
}
| 0
|
71,594
|
R_API st64 r_buf_fread(RBuffer *b, ut8 *buf, const char *fmt, int n) {
r_return_val_if_fail (b && buf && fmt, -1);
// XXX: we assume the caller knows what he's doing
RBuffer *dst = r_buf_new_with_pointers (buf, UT64_MAX, false);
st64 res = buf_format (dst, b, fmt, n);
r_buf_free (dst);
return res;
}
| 0
|
394,772
|
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
{
cwd_state new_state;
int retval;
CWD_STATE_COPY(&new_state, &CWDG(cwd));
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
CWD_STATE_FREE(&new_state);
return -1;
}
retval = php_sys_lstat(new_state.cwd, buf);
CWD_STATE_FREE(&new_state);
return retval;
}
| 0
|
188,985
|
int RenderViewImpl::historyForwardListCount() {
return history_list_length_ - historyBackListCount() - 1;
}
| 0
|
369,527
|
get_provider_group (GoaProvider *_provider)
{
return GOA_PROVIDER_GROUP_BRANDED;
}
| 0
|
11,190
|
void LinkChangeSerializerMarkupAccumulator::appendElement(StringBuilder& result, Element* element, Namespaces* namespaces)
{
if (element->hasTagName(HTMLNames::baseTag)) {
result.append("<!--");
} else if (element->hasTagName(HTMLNames::htmlTag)) {
result.append(String::format("\n<!-- saved from url=(%04d)%s -->\n",
static_cast<int>(m_document->url().string().utf8().length()),
m_document->url().string().utf8().data()));
}
SerializerMarkupAccumulator::appendElement(result, element, namespaces);
if (element->hasTagName(HTMLNames::baseTag)) {
result.appendLiteral("-->");
result.appendLiteral("<base href=\".\"");
if (!m_document->baseTarget().isEmpty()) {
result.appendLiteral(" target=\"");
result.append(m_document->baseTarget());
result.append('"');
}
if (m_document->isXHTMLDocument())
result.appendLiteral(" />");
else
result.appendLiteral(">");
}
}
| 1
|
401,201
|
static int macsec_validate_attr(struct nlattr *tb[], struct nlattr *data[])
{
u64 csid = MACSEC_DEFAULT_CIPHER_ID;
u8 icv_len = DEFAULT_ICV_LEN;
int flag;
bool es, scb, sci;
if (!data)
return 0;
if (data[IFLA_MACSEC_CIPHER_SUITE])
csid = nla_get_u64(data[IFLA_MACSEC_CIPHER_SUITE]);
if (data[IFLA_MACSEC_ICV_LEN]) {
icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);
if (icv_len != DEFAULT_ICV_LEN) {
char dummy_key[DEFAULT_SAK_LEN] = { 0 };
struct crypto_aead *dummy_tfm;
dummy_tfm = macsec_alloc_tfm(dummy_key,
DEFAULT_SAK_LEN,
icv_len);
if (IS_ERR(dummy_tfm))
return PTR_ERR(dummy_tfm);
crypto_free_aead(dummy_tfm);
}
}
switch (csid) {
case MACSEC_DEFAULT_CIPHER_ID:
case MACSEC_DEFAULT_CIPHER_ALT:
if (icv_len < MACSEC_MIN_ICV_LEN ||
icv_len > MACSEC_STD_ICV_LEN)
return -EINVAL;
break;
default:
return -EINVAL;
}
if (data[IFLA_MACSEC_ENCODING_SA]) {
if (nla_get_u8(data[IFLA_MACSEC_ENCODING_SA]) >= MACSEC_NUM_AN)
return -EINVAL;
}
for (flag = IFLA_MACSEC_ENCODING_SA + 1;
flag < IFLA_MACSEC_VALIDATION;
flag++) {
if (data[flag]) {
if (nla_get_u8(data[flag]) > 1)
return -EINVAL;
}
}
es = data[IFLA_MACSEC_ES] ? nla_get_u8(data[IFLA_MACSEC_ES]) : false;
sci = data[IFLA_MACSEC_INC_SCI] ? nla_get_u8(data[IFLA_MACSEC_INC_SCI]) : false;
scb = data[IFLA_MACSEC_SCB] ? nla_get_u8(data[IFLA_MACSEC_SCB]) : false;
if ((sci && (scb || es)) || (scb && es))
return -EINVAL;
if (data[IFLA_MACSEC_VALIDATION] &&
nla_get_u8(data[IFLA_MACSEC_VALIDATION]) > MACSEC_VALIDATE_MAX)
return -EINVAL;
if ((data[IFLA_MACSEC_REPLAY_PROTECT] &&
nla_get_u8(data[IFLA_MACSEC_REPLAY_PROTECT])) &&
!data[IFLA_MACSEC_WINDOW])
return -EINVAL;
return 0;
}
| 0
|
336,421
|
static void spr_write_403_pbr (void *opaque, int sprn)
{
DisasContext *ctx = opaque;
gen_op_store_403_pb(sprn - SPR_403_PBL1);
RET_STOP(ctx);
}
| 0
|
438,955
|
static void SFDDumpEncoding(FILE *sfd,Encoding *encname,const char *keyword) {
fprintf(sfd, "%s: %s\n", keyword, encname->enc_name );
}
| 0
|
18,170
|
void qdev_register ( DeviceInfo * info ) {
assert ( info -> size >= sizeof ( DeviceState ) ) ;
assert ( ! info -> next ) ;
info -> next = device_info_list ;
device_info_list = info ;
}
| 0
|
492,356
|
callbacks_zoom_out_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
render_zoom_display (ZOOM_OUT, 0, 0, 0);
}
| 0
|
64,391
|
NO_INLINE bool jspeFunctionDefinitionInternal(JsVar *funcVar, bool expressionOnly) {
bool forcePretokenise = false;
if (expressionOnly) {
if (funcVar)
funcVar->flags = (funcVar->flags & ~JSV_VARTYPEMASK) | JSV_FUNCTION_RETURN;
} else {
JSP_MATCH('{');
#ifndef SAVE_ON_FLASH
if (lex->tk==LEX_STR) {
if (!strcmp(jslGetTokenValueAsString(), "compiled"))
jsWarn("Function marked with \"compiled\" uploaded in source form");
if (lex->tk==LEX_STR && !strcmp(jslGetTokenValueAsString(), "ram")) {
JSP_ASSERT_MATCH(LEX_STR);
forcePretokenise = true;
}
}
#endif
/* If the function starts with return, treat it specially -
* we don't want to store the 'return' part of it
*/
if (funcVar && lex->tk==LEX_R_RETURN) {
funcVar->flags = (funcVar->flags & ~JSV_VARTYPEMASK) | JSV_FUNCTION_RETURN;
JSP_ASSERT_MATCH(LEX_R_RETURN);
}
}
#ifndef ESPR_NO_LINE_NUMBERS
// Get the line number (if needed)
JsVarInt lineNumber = 0;
if (funcVar && lex->lineNumberOffset && !(forcePretokenise||jsfGetFlag(JSF_PRETOKENISE))) {
// jslGetLineNumber is slow, so we only do it if we have debug info
lineNumber = (JsVarInt)jslGetLineNumber() + (JsVarInt)lex->lineNumberOffset - 1;
}
#endif
// Get the code - parse it and figure out where it stops
JslCharPos funcBegin;
jslSkipWhiteSpace();
jslCharPosNew(&funcBegin, lex->sourceVar, lex->tokenStart);
int lastTokenEnd = -1;
lex->hadThisKeyword = lex->tk == LEX_R_THIS;
if (!expressionOnly) {
int brackets = 0;
while (lex->tk && (brackets || lex->tk != '}')) {
if (lex->tk == '{') brackets++;
if (lex->tk == '}') brackets--;
lastTokenEnd = (int)jsvStringIteratorGetIndex(&lex->it)-1;
JSP_ASSERT_MATCH(lex->tk);
}
// FIXME: we might be including whitespace after the last token
} else {
JsExecFlags oldExec = execInfo.execute;
execInfo.execute = EXEC_NO;
jsvUnLock(jspeAssignmentExpression());
execInfo.execute = oldExec;
lastTokenEnd = (int)lex->tokenStart;
}
bool hadThisKeyword = lex->hadThisKeyword;
// Then create var and set (if there was any code!)
if (funcVar && lastTokenEnd>0) {
// code var
JsVar *funcCodeVar;
if (!forcePretokenise && jsvIsNativeString(lex->sourceVar)) {
/* If we're parsing from a Native String (eg. E.memoryArea, E.setBootCode) then
use another Native String to load function code straight from flash */
int s = (int)jsvStringIteratorGetIndex(&funcBegin.it) - 1;
funcCodeVar = jsvNewNativeString(lex->sourceVar->varData.nativeStr.ptr + s, (unsigned int)(lastTokenEnd - s));
#ifdef SPIFLASH_BASE
} else if (!forcePretokenise && jsvIsFlashString(lex->sourceVar)) {
/* If we're parsing from a Flash String (eg. loaded from Storage on Bangle.js) then
use another Flash String to load function code straight from flash*/
int s = (int)jsvStringIteratorGetIndex(&funcBegin.it) - 1;
funcCodeVar = jsvNewFlashString(lex->sourceVar->varData.nativeStr.ptr + s, (unsigned int)(lastTokenEnd - s));
#endif
} else {
if (jsfGetFlag(JSF_PRETOKENISE) || forcePretokenise) {
funcCodeVar = jslNewTokenisedStringFromLexer(&funcBegin, (size_t)lastTokenEnd);
} else {
funcCodeVar = jslNewStringFromLexer(&funcBegin, (size_t)lastTokenEnd);
}
}
jsvUnLock2(jsvAddNamedChild(funcVar, funcCodeVar, JSPARSE_FUNCTION_CODE_NAME), funcCodeVar);
// scope var
JsVar *funcScopeVar = jspeiGetScopesAsVar();
if (funcScopeVar) {
jsvUnLock2(jsvAddNamedChild(funcVar, funcScopeVar, JSPARSE_FUNCTION_SCOPE_NAME), funcScopeVar);
}
#ifndef ESPR_NO_LINE_NUMBERS
// If we've got a line number, add a var for it
if (lineNumber) {
JsVar *funcLineNumber = jsvNewFromInteger(lineNumber);
if (funcLineNumber) {
jsvUnLock2(jsvAddNamedChild(funcVar, funcLineNumber, JSPARSE_FUNCTION_LINENUMBER_NAME), funcLineNumber);
}
}
#endif
}
jslCharPosFree(&funcBegin);
if (!expressionOnly) JSP_MATCH('}');
return hadThisKeyword;
}
| 0
|
125,308
|
static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
{
if (nfs4_setup_sequence(NFS_SERVER(data->dir),
&data->args.seq_args,
&data->res.seq_res,
task))
return;
rpc_call_start(task);
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.