idx
int64 | func
string | target
int64 |
|---|---|---|
318,573
|
int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
const void *buf, int bytes)
{
QEMUIOVector qiov;
struct iovec iov = {
.iov_base = (void *) buf,
.iov_len = bytes,
};
if (bytes < 0) {
return -EINVAL;
}
qemu_iovec_init_external(&qiov, &iov, 1);
return bdrv_pwritev(bs, offset, &qiov);
}
| 0
|
83,322
|
php_apache_sapi_flush(void *server_context)
{
php_struct *ctx;
request_rec *r;
TSRMLS_FETCH();
ctx = server_context;
/* If we haven't registered a server_context yet,
* then don't bother flushing. */
if (!server_context) {
return;
}
r = ctx->r;
sapi_send_headers(TSRMLS_C);
r->status = SG(sapi_headers).http_response_code;
SG(headers_sent) = 1;
if (ap_rflush(r) < 0 || r->connection->aborted) {
php_handle_aborted_connection();
}
}
| 0
|
254,140
|
void AXLayoutObject::setSelection(const AXRange& selection) {
if (!getLayoutObject() || !selection.isValid())
return;
AXObject* anchorObject =
selection.anchorObject ? selection.anchorObject.get() : this;
AXObject* focusObject =
selection.focusObject ? selection.focusObject.get() : this;
if (!isValidSelectionBound(anchorObject) ||
!isValidSelectionBound(focusObject)) {
return;
}
if (anchorObject == focusObject &&
anchorObject->getLayoutObject()->isTextControl()) {
TextControlElement* textControl =
toLayoutTextControl(anchorObject->getLayoutObject())
->textControlElement();
if (selection.anchorOffset <= selection.focusOffset) {
textControl->setSelectionRange(selection.anchorOffset,
selection.focusOffset,
SelectionHasForwardDirection);
} else {
textControl->setSelectionRange(selection.focusOffset,
selection.anchorOffset,
SelectionHasBackwardDirection);
}
return;
}
LocalFrame* frame = getLayoutObject()->frame();
if (!frame)
return;
frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
VisiblePosition anchorVisiblePosition =
toVisiblePosition(anchorObject, selection.anchorOffset);
VisiblePosition focusVisiblePosition =
toVisiblePosition(focusObject, selection.focusOffset);
if (anchorVisiblePosition.isNull() || focusVisiblePosition.isNull())
return;
frame->selection().setSelection(
SelectionInDOMTree::Builder()
.collapse(anchorVisiblePosition.toPositionWithAffinity())
.extend(focusVisiblePosition.deepEquivalent())
.build());
}
| 0
|
345,747
|
PHP_HASH_API void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * context)
{
unsigned char bits[10];
unsigned int index, padLen;
/* Version, Passes, and Digest Length */
bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) |
((context->passes & 0x07) << 3) |
((context->output & 0x03) << 6);
bits[1] = (context->output >> 2);
/* Save number of bits */
Encode(bits + 2, context->count, 8);
/* Pad out to 118 mod 128.
*/
index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
padLen = (index < 118) ? (118 - index) : (246 - index);
PHP_HAVALUpdate(context, PADDING, padLen);
/* Append version, passes, digest length, and message length */
PHP_HAVALUpdate(context, bits, 10);
/* Store state in digest */
context->state[6] += context->state[7] & 0x0000000F;
context->state[5] += (context->state[7] >> 4) & 0x0000001F;
context->state[4] += (context->state[7] >> 9) & 0x0000000F;
context->state[3] += (context->state[7] >> 13) & 0x0000001F;
context->state[2] += (context->state[7] >> 18) & 0x0000000F;
context->state[1] += (context->state[7] >> 22) & 0x0000001F;
context->state[0] += (context->state[7] >> 27) & 0x0000001F;
Encode(digest, context->state, 28);
/* Zeroize sensitive information.
*/
memset((unsigned char*) context, 0, sizeof(*context));
}
| 1
|
392,389
|
xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlAttrPtr attr, const xmlChar * string)
{
xmlChar *base, *cur;
if (string == NULL)
return;
base = cur = (xmlChar *) string;
while (*cur != 0) {
if (*cur == '\n') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST " ", 5);
cur++;
base = cur;
} else if (*cur == '\r') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST " ", 5);
cur++;
base = cur;
} else if (*cur == '\t') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST "	", 4);
cur++;
base = cur;
} else if (*cur == '"') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST """, 6);
cur++;
base = cur;
} else if (*cur == '<') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST "<", 4);
cur++;
base = cur;
} else if (*cur == '>') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST ">", 4);
cur++;
base = cur;
} else if (*cur == '&') {
if (base != cur)
xmlBufAdd(buf, base, cur - base);
xmlBufAdd(buf, BAD_CAST "&", 5);
cur++;
base = cur;
} else if ((*cur >= 0x80) && (cur[1] != 0) &&
((doc == NULL) || (doc->encoding == NULL))) {
/*
* We assume we have UTF-8 content.
*/
unsigned char tmp[12];
int val = 0, l = 1;
if (base != cur)
xmlBufAdd(buf, base, cur - base);
if (*cur < 0xC0) {
xmlSaveErr(XML_SAVE_NOT_UTF8, (xmlNodePtr) attr, NULL);
if (doc != NULL)
doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
xmlSerializeHexCharRef(tmp, *cur);
xmlBufAdd(buf, (xmlChar *) tmp, -1);
cur++;
base = cur;
continue;
} else if (*cur < 0xE0) {
val = (cur[0]) & 0x1F;
val <<= 6;
val |= (cur[1]) & 0x3F;
l = 2;
} else if ((*cur < 0xF0) && (cur [2] != 0)) {
val = (cur[0]) & 0x0F;
val <<= 6;
val |= (cur[1]) & 0x3F;
val <<= 6;
val |= (cur[2]) & 0x3F;
l = 3;
} else if ((*cur < 0xF8) && (cur [2] != 0) && (cur[3] != 0)) {
val = (cur[0]) & 0x07;
val <<= 6;
val |= (cur[1]) & 0x3F;
val <<= 6;
val |= (cur[2]) & 0x3F;
val <<= 6;
val |= (cur[3]) & 0x3F;
l = 4;
}
if ((l == 1) || (!IS_CHAR(val))) {
xmlSaveErr(XML_SAVE_CHAR_INVALID, (xmlNodePtr) attr, NULL);
if (doc != NULL)
doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
xmlSerializeHexCharRef(tmp, *cur);
xmlBufAdd(buf, (xmlChar *) tmp, -1);
cur++;
base = cur;
continue;
}
/*
* We could do multiple things here. Just save
* as a char ref
*/
xmlSerializeHexCharRef(tmp, val);
xmlBufAdd(buf, (xmlChar *) tmp, -1);
cur += l;
base = cur;
} else {
cur++;
}
}
if (base != cur)
xmlBufAdd(buf, base, cur - base);
}
| 0
|
3,185
|
static void get_over(struct SYMBOL *s)
{
struct VOICE_S *p_voice, *p_voice2, *p_voice3;
int range, voice, voice2, voice3;
static char tx_wrong_dur[] = "Wrong duration in voice overlay";
static char txt_no_note[] = "No note in voice overlay";
/* treat the end of overlay */
p_voice = curvoice;
if (p_voice->ignore)
return;
if (s->abc_type == ABC_T_BAR
|| s->u.v_over.type == V_OVER_E) {
if (!p_voice->last_sym) {
error(1, s, txt_no_note);
return;
}
p_voice->last_sym->sflags |= S_BEAM_END;
over_bar = 0;
if (over_time < 0) {
error(1, s, "Erroneous end of voice overlap");
return;
}
if (p_voice->time != over_mxtime)
error(1, s, tx_wrong_dur);
curvoice = &voice_tb[over_voice];
over_mxtime = 0;
over_voice = -1;
over_time = -1;
return;
}
/* treat the full overlay start */
if (s->u.v_over.type == V_OVER_S) {
over_voice = p_voice - voice_tb;
over_time = p_voice->time;
return;
}
/* (here is treated a new overlay - '&') */
/* create the extra voice if not done yet */
if (!p_voice->last_sym) {
error(1, s, txt_no_note);
return;
}
p_voice->last_sym->sflags |= S_BEAM_END;
voice2 = s->u.v_over.voice;
p_voice2 = &voice_tb[voice2];
if (parsys->voice[voice2].range < 0) {
int clone;
if (cfmt.abc2pscompat) {
error(1, s, "Cannot have %%%%abc2pscompat");
cfmt.abc2pscompat = 0;
}
clone = p_voice->clone >= 0;
p_voice2->id[0] = '&';
p_voice2->id[1] = '\0';
p_voice2->second = 1;
parsys->voice[voice2].second = 1;
p_voice2->scale = p_voice->scale;
p_voice2->octave = p_voice->octave;
p_voice2->transpose = p_voice->transpose;
memcpy(&p_voice2->key, &p_voice->key,
sizeof p_voice2->key);
memcpy(&p_voice2->ckey, &p_voice->ckey,
sizeof p_voice2->ckey);
memcpy(&p_voice2->okey, &p_voice->okey,
sizeof p_voice2->okey);
p_voice2->posit = p_voice->posit;
p_voice2->staff = p_voice->staff;
p_voice2->cstaff = p_voice->cstaff;
p_voice2->color = p_voice->color;
p_voice2->map_name = p_voice->map_name;
range = parsys->voice[p_voice - voice_tb].range;
for (voice = 0; voice < MAXVOICE; voice++) {
if (parsys->voice[voice].range > range)
parsys->voice[voice].range += clone + 1;
}
parsys->voice[voice2].range = range + 1;
voice_link(p_voice2);
if (clone) {
for (voice3 = MAXVOICE; --voice3 >= 0; ) {
if (parsys->voice[voice3].range < 0)
break;
}
if (voice3 > 0) {
p_voice3 = &voice_tb[voice3];
strcpy(p_voice3->id, p_voice2->id);
p_voice3->second = 1;
parsys->voice[voice3].second = 1;
p_voice3->scale = voice_tb[p_voice->clone].scale;
parsys->voice[voice3].range = range + 2;
voice_link(p_voice3);
p_voice2->clone = voice3;
} else {
error(1, s,
"Too many voices for overlay cloning");
}
}
}
voice = p_voice - voice_tb;
// p_voice2->cstaff = p_voice2->staff = parsys->voice[voice2].staff
// = parsys->voice[voice].staff;
// if ((voice3 = p_voice2->clone) >= 0) {
// p_voice3 = &voice_tb[voice3];
// p_voice3->cstaff = p_voice3->staff
// = parsys->voice[voice3].staff
// = parsys->voice[p_voice->clone].staff;
// }
if (over_time < 0) { /* first '&' in a measure */
int time;
over_bar = 1;
over_mxtime = p_voice->time;
over_voice = voice;
time = p_voice2->time;
for (s = p_voice->last_sym; /*s*/; s = s->prev) {
if (s->type == BAR
|| s->time <= time) /* (if start of tune) */
break;
}
over_time = s->time;
} else {
if (over_mxtime == 0)
over_mxtime = p_voice->time;
else if (p_voice->time != over_mxtime)
error(1, s, tx_wrong_dur);
}
p_voice2->time = over_time;
curvoice = p_voice2;
}
| 1
|
192,017
|
static void clear_leases(const uint8_t *chaddr, uint32_t yiaddr)
{
unsigned i;
for (i = 0; i < server_config.max_leases; i++) {
if ((chaddr && memcmp(g_leases[i].lease_mac, chaddr, 6) == 0)
|| (yiaddr && g_leases[i].lease_nip == yiaddr)
) {
memset(&g_leases[i], 0, sizeof(g_leases[i]));
}
}
}
| 0
|
217,094
|
void OneClickSigninHelper::LogConfirmHistogramValue(int action) {
UMA_HISTOGRAM_ENUMERATION("Signin.OneClickConfirmation", action,
one_click_signin::HISTOGRAM_CONFIRM_MAX);
}
| 0
|
127,897
|
irc_server_get_prefix_modes (struct t_irc_server *server)
{
return (server && server->prefix_modes) ?
server->prefix_modes : irc_server_prefix_modes_default;
}
| 0
|
230,758
|
encode_REG_MOVE(const struct ofpact_reg_move *move,
enum ofp_version ofp_version, struct ofpbuf *out)
{
/* For OpenFlow 1.3, the choice of ONFACT_RAW13_COPY_FIELD versus
* NXAST_RAW_REG_MOVE is somewhat difficult. Neither one is guaranteed to
* be supported by every OpenFlow 1.3 implementation. It would be ideal to
* probe for support. Until we have that ability, we currently prefer
* NXAST_RAW_REG_MOVE for backward compatibility with older Open vSwitch
* versions. */
size_t start_ofs = out->size;
if (ofp_version >= OFP15_VERSION) {
struct ofp15_action_copy_field *copy = put_OFPAT15_COPY_FIELD(out);
copy->n_bits = htons(move->dst.n_bits);
copy->src_offset = htons(move->src.ofs);
copy->dst_offset = htons(move->dst.ofs);
out->size = out->size - sizeof copy->pad2;
nx_put_mff_header(out, move->src.field, ofp_version, false);
nx_put_mff_header(out, move->dst.field, ofp_version, false);
} else if (ofp_version == OFP13_VERSION
&& move->ofpact.raw == ONFACT_RAW13_COPY_FIELD) {
struct onf_action_copy_field *copy = put_ONFACT13_COPY_FIELD(out);
copy->n_bits = htons(move->dst.n_bits);
copy->src_offset = htons(move->src.ofs);
copy->dst_offset = htons(move->dst.ofs);
out->size = out->size - sizeof copy->pad3;
nx_put_mff_header(out, move->src.field, ofp_version, false);
nx_put_mff_header(out, move->dst.field, ofp_version, false);
} else {
struct nx_action_reg_move *narm = put_NXAST_REG_MOVE(out);
narm->n_bits = htons(move->dst.n_bits);
narm->src_ofs = htons(move->src.ofs);
narm->dst_ofs = htons(move->dst.ofs);
nx_put_mff_header(out, move->src.field, 0, false);
nx_put_mff_header(out, move->dst.field, 0, false);
}
pad_ofpat(out, start_ofs);
}
| 0
|
336,163
|
static bool blit_region_is_unsafe(struct CirrusVGAState *s,
int32_t pitch, int32_t addr)
{
if (pitch < 0) {
int64_t min = addr
+ ((int64_t)s->cirrus_blt_height-1) * pitch;
int32_t max = addr
+ s->cirrus_blt_width;
if (min < 0 || max >= s->vga.vram_size) {
return true;
}
} else {
int64_t max = addr
+ ((int64_t)s->cirrus_blt_height-1) * pitch
+ s->cirrus_blt_width;
if (max >= s->vga.vram_size) {
return true;
}
}
return false;
}
| 1
|
228,411
|
ewk_frame_scroll_set(Evas_Object* ewkFrame, int x, int y)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->view(), false);
smartData->frame->view()->setScrollPosition(WebCore::IntPoint(x, y));
return true;
}
| 0
|
158,011
|
static void pci_basic(gconstpointer data)
{
QVirtioPCIDevice *dev;
QPCIBus *bus;
QVirtQueuePCI *tx, *rx;
QGuestAllocator *alloc;
void (*func) (QVirtioDevice *dev,
QGuestAllocator *alloc,
QVirtQueue *rvq,
QVirtQueue *tvq,
int socket) = data;
int sv[2], ret;
ret = socketpair(PF_UNIX, SOCK_STREAM, 0, sv);
g_assert_cmpint(ret, !=, -1);
bus = pci_test_start(sv[1]);
dev = virtio_net_pci_init(bus, PCI_SLOT);
alloc = pc_alloc_init();
rx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 0);
tx = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, 1);
driver_init(&dev->vdev);
func(&dev->vdev, alloc, &rx->vq, &tx->vq, sv[0]);
/* End test */
close(sv[0]);
qvirtqueue_cleanup(dev->vdev.bus, &tx->vq, alloc);
qvirtqueue_cleanup(dev->vdev.bus, &rx->vq, alloc);
pc_alloc_uninit(alloc);
qvirtio_pci_device_disable(dev);
g_free(dev->pdev);
g_free(dev);
qpci_free_pc(bus);
test_end();
}
| 0
|
467,205
|
std::string RGWFormPost::get_current_content_type() const
{
try {
const auto& field = current_data_part->fields.at("Content-Type");
return field.val;
} catch (std::out_of_range&) {
/* NOP */;
}
return std::string();
}
| 0
|
435,434
|
int proppatch_principalname(xmlNodePtr prop, unsigned set,
struct proppatch_ctx *pctx,
struct propstat propstat[],
void *rock __attribute__((unused)))
{
struct mailbox *mailbox = pctx->mailbox;
struct mailbox *calhomeset = NULL;
if (pctx->txn->req_tgt.namespace->id == URL_NS_PRINCIPAL) {
/* We have been storing CUAS on cal-home-set, NOT INBOX */
char *mboxname = caldav_mboxname(pctx->txn->req_tgt.userid, NULL);
int r = 0;
if (!mailbox || strcmp(mboxname, mailbox->name)) {
r = mailbox_open_iwl(mboxname, &calhomeset);
if (!r) pctx->mailbox = calhomeset;
}
free(mboxname);
if (r) {
xml_add_prop(HTTP_SERVER_ERROR, pctx->ns[NS_DAV],
&propstat[PROPSTAT_ERROR],
prop->name, prop->ns, NULL, 0);
*pctx->ret = HTTP_SERVER_ERROR;
return 0;
}
}
else {
/* shouldn't happen! Internal server error 'r' us */
*pctx->ret = HTTP_SERVER_ERROR;
return 0;
}
/* Make sure this is on a collection and the user has admin rights */
if (pctx->txn->req_tgt.resource ||
!(cyrus_acl_myrights(httpd_authstate, pctx->mailbox->acl) & DACL_ADMIN)) {
xml_add_prop(HTTP_FORBIDDEN, pctx->ns[NS_DAV],
&propstat[PROPSTAT_FORBID],
prop->name, prop->ns, NULL, 0);
*pctx->ret = HTTP_FORBIDDEN;
}
else {
char *value = NULL;
if (set) {
value = (char *) xmlNodeGetContent(prop);
}
proppatch_todb(prop, set, pctx, propstat, (void *) value);
free(value);
}
if (calhomeset) {
mailbox_close(&calhomeset);
pctx->mailbox = mailbox;
}
return 0;
}
| 0
|
320,698
|
static void handle_arg_log_filename(const char *arg)
{
qemu_set_log_filename(arg);
}
| 1
|
309,933
|
RelayTruncatePlatformFile(base::PlatformFile file,
int64 length,
base::FileUtilProxy::StatusCallback* callback)
: RelayWithStatusCallback(callback),
file_(file),
length_(length) {
}
| 0
|
242,962
|
void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) {
DCHECK(page_number_ == PageNumber::npos());
owner_ = new_owner;
}
| 0
|
301,281
|
static void muscle_load_single_acl(sc_file_t* file, int operation, unsigned short acl)
{
int key;
/* Everybody by default.... */
sc_file_add_acl_entry(file, operation, SC_AC_NONE, 0);
if(acl == 0xFFFF) {
sc_file_add_acl_entry(file, operation, SC_AC_NEVER, 0);
return;
}
for(key = 0; key < 16; key++) {
if(acl >> key & 1) {
sc_file_add_acl_entry(file, operation, SC_AC_CHV, key);
}
}
}
| 0
|
60,832
|
CModule::EModRet CModule::OnPrivNotice(CNick& Nick, CString& sMessage) {
return CONTINUE;
}
| 0
|
171,177
|
bool ParamTraits<base::TimeDelta>::Read(const Message* m,
PickleIterator* iter,
param_type* r) {
int64 value;
bool ret = ParamTraits<int64>::Read(m, iter, &value);
if (ret)
*r = base::TimeDelta::FromInternalValue(value);
return ret;
}
| 0
|
487,783
|
static void ext4_mb_show_ac(struct ext4_allocation_context *ac)
{
struct super_block *sb = ac->ac_sb;
if (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED)
return;
mb_debug(sb, "Can't allocate:"
" Allocation context details:");
mb_debug(sb, "status %u flags 0x%x",
ac->ac_status, ac->ac_flags);
mb_debug(sb, "orig %lu/%lu/%lu@%lu, "
"goal %lu/%lu/%lu@%lu, "
"best %lu/%lu/%lu@%lu cr %d",
(unsigned long)ac->ac_o_ex.fe_group,
(unsigned long)ac->ac_o_ex.fe_start,
(unsigned long)ac->ac_o_ex.fe_len,
(unsigned long)ac->ac_o_ex.fe_logical,
(unsigned long)ac->ac_g_ex.fe_group,
(unsigned long)ac->ac_g_ex.fe_start,
(unsigned long)ac->ac_g_ex.fe_len,
(unsigned long)ac->ac_g_ex.fe_logical,
(unsigned long)ac->ac_b_ex.fe_group,
(unsigned long)ac->ac_b_ex.fe_start,
(unsigned long)ac->ac_b_ex.fe_len,
(unsigned long)ac->ac_b_ex.fe_logical,
(int)ac->ac_criteria);
mb_debug(sb, "%u found", ac->ac_found);
ext4_mb_show_pa(sb);
}
| 0
|
520,034
|
wait_for_commit *suspend_subsequent_commits() {
wait_for_commit *suspended= wait_for_commit_ptr;
wait_for_commit_ptr= NULL;
return suspended;
}
| 0
|
123,731
|
check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
struct xt_table_info *newinfo,
unsigned int *size,
const unsigned char *base,
const unsigned char *limit)
{
struct xt_entry_match *ematch;
struct xt_entry_target *t;
struct xt_target *target;
unsigned int entry_offset;
unsigned int j;
int ret, off;
if ((unsigned long)e % __alignof__(struct compat_ip6t_entry) != 0 ||
(unsigned char *)e + sizeof(struct compat_ip6t_entry) >= limit ||
(unsigned char *)e + e->next_offset > limit)
return -EINVAL;
if (e->next_offset < sizeof(struct compat_ip6t_entry) +
sizeof(struct compat_xt_entry_target))
return -EINVAL;
if (!ip6_checkentry(&e->ipv6))
return -EINVAL;
ret = xt_compat_check_entry_offsets(e, e->elems,
e->target_offset, e->next_offset);
if (ret)
return ret;
off = sizeof(struct ip6t_entry) - sizeof(struct compat_ip6t_entry);
entry_offset = (void *)e - (void *)base;
j = 0;
xt_ematch_foreach(ematch, e) {
ret = compat_find_calc_match(ematch, &e->ipv6, &off);
if (ret != 0)
goto release_matches;
++j;
}
t = compat_ip6t_get_target(e);
target = xt_request_find_target(NFPROTO_IPV6, t->u.user.name,
t->u.user.revision);
if (IS_ERR(target)) {
ret = PTR_ERR(target);
goto release_matches;
}
t->u.kernel.target = target;
off += xt_compat_target_offset(target);
*size += off;
ret = xt_compat_add_offset(AF_INET6, entry_offset, off);
if (ret)
goto out;
return 0;
out:
module_put(t->u.kernel.target->me);
release_matches:
xt_ematch_foreach(ematch, e) {
if (j-- == 0)
break;
module_put(ematch->u.kernel.match->me);
}
return ret;
}
| 0
|
369,941
|
static int inet6_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
struct ipv6_devconf *devconf, u32 portid,
u32 seq, int event, unsigned int flags,
int type)
{
struct nlmsghdr *nlh;
struct netconfmsg *ncm;
nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg),
flags);
if (nlh == NULL)
return -EMSGSIZE;
ncm = nlmsg_data(nlh);
ncm->ncm_family = AF_INET6;
if (nla_put_s32(skb, NETCONFA_IFINDEX, ifindex) < 0)
goto nla_put_failure;
/* type -1 is used for ALL */
if ((type == -1 || type == NETCONFA_FORWARDING) &&
nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0)
goto nla_put_failure;
#ifdef CONFIG_IPV6_MROUTE
if ((type == -1 || type == NETCONFA_MC_FORWARDING) &&
nla_put_s32(skb, NETCONFA_MC_FORWARDING,
devconf->mc_forwarding) < 0)
goto nla_put_failure;
#endif
return nlmsg_end(skb, nlh);
nla_put_failure:
nlmsg_cancel(skb, nlh);
return -EMSGSIZE;
}
| 0
|
81,835
|
MagickExport MagickBooleanType LevelImage(Image *image,const double black_point,
const double white_point,const double gamma,ExceptionInfo *exception)
{
#define LevelImageTag "Level/Image"
CacheView
*image_view;
MagickBooleanType
status;
MagickOffsetType
progress;
register ssize_t
i;
ssize_t
y;
/*
Allocate and initialize levels map.
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->storage_class == PseudoClass)
for (i=0; i < (ssize_t) image->colors; i++)
{
/*
Level colormap.
*/
if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].red=(double) ClampToQuantum(LevelPixel(black_point,
white_point,gamma,image->colormap[i].red));
if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].green=(double) ClampToQuantum(LevelPixel(black_point,
white_point,gamma,image->colormap[i].green));
if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].blue=(double) ClampToQuantum(LevelPixel(black_point,
white_point,gamma,image->colormap[i].blue));
if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
image->colormap[i].alpha=(double) ClampToQuantum(LevelPixel(black_point,
white_point,gamma,image->colormap[i].alpha));
}
/*
Level image.
*/
status=MagickTrue;
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
register ssize_t
j;
if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
}
for (j=0; j < (ssize_t) GetPixelChannels(image); j++)
{
PixelChannel channel=GetPixelChannelChannel(image,j);
PixelTrait traits=GetPixelChannelTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
q[j]=ClampToQuantum(LevelPixel(black_point,white_point,gamma,
(double) q[j]));
}
q+=GetPixelChannels(image);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_LevelImage)
#endif
proceed=SetImageProgress(image,LevelImageTag,progress++,image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
(void) ClampImage(image,exception);
return(status);
}
| 0
|
413,223
|
int ldb_sqlite3_init(const char *version)
{
LDB_MODULE_CHECK_VERSION(version);
return ldb_register_backend("sqlite3", lsqlite3_connect, false);
}
| 0
|
484,980
|
static Image *ReadGROUP4Image(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
filename[MagickPathExtent];
FILE
*file;
Image
*image;
ImageInfo
*read_info;
int
c,
unique_file;
MagickBooleanType
status;
size_t
length;
ssize_t
offset,
strip_offset;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
if (IsEventLogging() != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Write raw CCITT Group 4 wrapped as a TIFF image file.
*/
file=(FILE *) NULL;
unique_file=AcquireUniqueFileResource(filename);
if (unique_file != -1)
file=fdopen(unique_file,"wb");
if ((unique_file == -1) || (file == (FILE *) NULL))
ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
length=fwrite("\111\111\052\000\010\000\000\000\016\000",1,10,file);
if (length != 10)
ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");
length=fwrite("\376\000\003\000\001\000\000\000\000\000\000\000",1,12,file);
length=fwrite("\000\001\004\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) image->columns);
length=fwrite("\001\001\004\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) image->rows);
length=fwrite("\002\001\003\000\001\000\000\000\001\000\000\000",1,12,file);
length=fwrite("\003\001\003\000\001\000\000\000\004\000\000\000",1,12,file);
length=fwrite("\006\001\003\000\001\000\000\000\000\000\000\000",1,12,file);
length=fwrite("\021\001\003\000\001\000\000\000",1,8,file);
strip_offset=10+(12*14)+4+8;
length=WriteLSBLong(file,(unsigned int) strip_offset);
length=fwrite("\022\001\003\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) image_info->orientation);
length=fwrite("\025\001\003\000\001\000\000\000\001\000\000\000",1,12,file);
length=fwrite("\026\001\004\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) image->rows);
length=fwrite("\027\001\004\000\001\000\000\000\000\000\000\000",1,12,file);
offset=(ssize_t) ftell(file)-4;
length=fwrite("\032\001\005\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) (strip_offset-8));
length=fwrite("\033\001\005\000\001\000\000\000",1,8,file);
length=WriteLSBLong(file,(unsigned int) (strip_offset-8));
length=fwrite("\050\001\003\000\001\000\000\000\002\000\000\000",1,12,file);
length=fwrite("\000\000\000\000",1,4,file);
length=WriteLSBLong(file,(unsigned int) image->resolution.x);
length=WriteLSBLong(file,1);
status=MagickTrue;
for (length=0; (c=ReadBlobByte(image)) != EOF; length++)
if (fputc(c,file) != c)
status=MagickFalse;
offset=(ssize_t) fseek(file,(off_t) offset,SEEK_SET);
length=WriteLSBLong(file,(unsigned int) length);
if (ferror(file) != 0)
{
(void) fclose(file);
ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile");
}
(void) fclose(file);
(void) CloseBlob(image);
image=DestroyImage(image);
/*
Read TIFF image.
*/
read_info=CloneImageInfo((ImageInfo *) NULL);
(void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s",filename);
image=ReadTIFFImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
{
(void) CopyMagickString(image->filename,image_info->filename,
MagickPathExtent);
(void) CopyMagickString(image->magick_filename,image_info->filename,
MagickPathExtent);
(void) CopyMagickString(image->magick,"GROUP4",MagickPathExtent);
}
(void) RelinquishUniqueFileResource(filename);
if (status == MagickFalse)
image=DestroyImage(image);
return(image);
}
| 0
|
225,607
|
void AXLayoutObject::detach() {
AXNodeObject::detach();
detachRemoteSVGRoot();
#if DCHECK_IS_ON()
if (m_layoutObject)
m_layoutObject->setHasAXObject(false);
#endif
m_layoutObject = 0;
}
| 0
|
261,662
|
TEST_P(Http2CodecImplTest, SmallMetadataVecTest) {
allow_metadata_ = true;
initialize();
// Generates a valid stream_id by sending a request header.
TestHeaderMapImpl request_headers;
HttpTestUtility::addDefaultHeaders(request_headers);
EXPECT_CALL(request_decoder_, decodeHeaders_(_, true));
request_encoder_->encodeHeaders(request_headers, true);
MetadataMapVector metadata_map_vector;
const int size = 10;
for (int i = 0; i < size; i++) {
MetadataMap metadata_map = {
{"header_key1", "header_value1"},
{"header_key2", "header_value2"},
{"header_key3", "header_value3"},
{"header_key4", "header_value4"},
};
MetadataMapPtr metadata_map_ptr = std::make_unique<MetadataMap>(metadata_map);
metadata_map_vector.push_back(std::move(metadata_map_ptr));
}
EXPECT_CALL(request_decoder_, decodeMetadata_(_)).Times(size);
request_encoder_->encodeMetadata(metadata_map_vector);
EXPECT_CALL(response_decoder_, decodeMetadata_(_)).Times(size);
response_encoder_->encodeMetadata(metadata_map_vector);
}
| 0
|
444,676
|
TEST_F(HttpConnectionManagerImplTest, RouteShouldUseNormalizedHost) {
setup(false, "");
// Enable port removal
strip_matching_port_ = true;
const std::string original_host = "host:443";
const std::string normalized_host = "host";
EXPECT_CALL(*codec_, dispatch(_)).WillOnce(Invoke([&](Buffer::Instance&) -> Http::Status {
RequestDecoder* decoder = &conn_manager_->newStream(response_encoder_);
RequestHeaderMapPtr headers{new TestRequestHeaderMapImpl{
{":authority", original_host}, {":path", "/"}, {":method", "GET"}}};
decoder->decodeHeaders(std::move(headers), true);
return Http::okStatus();
}));
const std::string fake_cluster_name = "fake_cluster";
std::shared_ptr<Upstream::MockThreadLocalCluster> fake_cluster =
std::make_shared<NiceMock<Upstream::MockThreadLocalCluster>>();
std::shared_ptr<Router::MockRoute> route = std::make_shared<NiceMock<Router::MockRoute>>();
EXPECT_CALL(route->route_entry_, clusterName()).WillRepeatedly(ReturnRef(fake_cluster_name));
EXPECT_CALL(*route_config_provider_.route_config_, route(_, _, _, _))
.WillOnce(Invoke([&](const Router::RouteCallback&, const Http::RequestHeaderMap& header_map,
const StreamInfo::StreamInfo&, uint64_t) {
EXPECT_EQ(normalized_host, header_map.getHostValue());
return route;
}));
EXPECT_CALL(filter_factory_, createFilterChain(_))
.WillOnce(Invoke([&](FilterChainFactoryCallbacks&) -> void {}));
// Kick off the incoming data.
Buffer::OwnedImpl fake_input("1234");
conn_manager_->onData(fake_input, false);
}
| 0
|
146,673
|
static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
{
const unsigned long *fields[] = {
shadow_read_write_fields,
shadow_read_only_fields
};
const int max_fields[] = {
max_shadow_read_write_fields,
max_shadow_read_only_fields
};
int i, q;
unsigned long field;
u64 field_value = 0;
struct vmcs *shadow_vmcs = vmx->nested.current_shadow_vmcs;
vmcs_load(shadow_vmcs);
for (q = 0; q < ARRAY_SIZE(fields); q++) {
for (i = 0; i < max_fields[q]; i++) {
field = fields[q][i];
vmcs12_read_any(&vmx->vcpu, field, &field_value);
switch (vmcs_field_type(field)) {
case VMCS_FIELD_TYPE_U16:
vmcs_write16(field, (u16)field_value);
break;
case VMCS_FIELD_TYPE_U32:
vmcs_write32(field, (u32)field_value);
break;
case VMCS_FIELD_TYPE_U64:
vmcs_write64(field, (u64)field_value);
break;
case VMCS_FIELD_TYPE_NATURAL_WIDTH:
vmcs_writel(field, (long)field_value);
break;
}
}
}
vmcs_clear(shadow_vmcs);
vmcs_load(vmx->loaded_vmcs->vmcs);
}
| 0
|
128,066
|
mono_thread_get_undeniable_exception (void)
{
MonoInternalThread *thread = mono_thread_internal_current ();
if (thread && thread->abort_exc && !is_running_protected_wrapper ()) {
/*
* FIXME: Clear the abort exception and return an AppDomainUnloaded
* exception if the thread no longer references a dying appdomain.
*/
thread->abort_exc->trace_ips = NULL;
thread->abort_exc->stack_trace = NULL;
return thread->abort_exc;
}
return NULL;
}
| 0
|
142,121
|
static int del_dac(struct task_struct *child, int slot)
{
if (slot == 1) {
if ((dbcr_dac(child) & (DBCR_DAC1R | DBCR_DAC1W)) == 0)
return -ENOENT;
child->thread.debug.dac1 = 0;
dbcr_dac(child) &= ~(DBCR_DAC1R | DBCR_DAC1W);
#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE) {
child->thread.debug.dac2 = 0;
child->thread.debug.dbcr2 &= ~DBCR2_DAC12MODE;
}
child->thread.debug.dbcr2 &= ~(DBCR2_DVC1M | DBCR2_DVC1BE);
#endif
#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
child->thread.debug.dvc1 = 0;
#endif
} else if (slot == 2) {
if ((dbcr_dac(child) & (DBCR_DAC2R | DBCR_DAC2W)) == 0)
return -ENOENT;
#ifdef CONFIG_PPC_ADV_DEBUG_DAC_RANGE
if (child->thread.debug.dbcr2 & DBCR2_DAC12MODE)
/* Part of a range */
return -EINVAL;
child->thread.debug.dbcr2 &= ~(DBCR2_DVC2M | DBCR2_DVC2BE);
#endif
#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
child->thread.debug.dvc2 = 0;
#endif
child->thread.debug.dac2 = 0;
dbcr_dac(child) &= ~(DBCR_DAC2R | DBCR_DAC2W);
} else
return -EINVAL;
return 0;
}
| 0
|
110,612
|
static int ast_write_header(AVFormatContext *s)
{
ASTMuxContext *ast = s->priv_data;
AVIOContext *pb = s->pb;
AVCodecContext *enc;
unsigned int codec_tag;
if (s->nb_streams == 1) {
enc = s->streams[0]->codec;
} else {
av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
}
if (enc->codec_id == AV_CODEC_ID_ADPCM_AFC) {
av_log(s, AV_LOG_ERROR, "muxing ADPCM AFC is not implemented\n");
return AVERROR_PATCHWELCOME;
}
codec_tag = ff_codec_get_tag(ff_codec_ast_tags, enc->codec_id);
if (!codec_tag) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
}
if (ast->loopstart && ast->loopend && ast->loopstart >= ast->loopend) {
av_log(s, AV_LOG_ERROR, "loopend can't be less or equal to loopstart\n");
return AVERROR(EINVAL);
}
/* Convert milliseconds to samples */
CHECK_LOOP(start)
CHECK_LOOP(end)
ffio_wfourcc(pb, "STRM");
ast->size = avio_tell(pb);
avio_wb32(pb, 0); /* File size minus header */
avio_wb16(pb, codec_tag);
avio_wb16(pb, 16); /* Bit depth */
avio_wb16(pb, enc->channels);
avio_wb16(pb, 0xFFFF);
avio_wb32(pb, enc->sample_rate);
ast->samples = avio_tell(pb);
avio_wb32(pb, 0); /* Number of samples */
avio_wb32(pb, 0); /* Loopstart */
avio_wb32(pb, 0); /* Loopend */
avio_wb32(pb, 0); /* Size of first block */
/* Unknown */
avio_wb32(pb, 0);
avio_wl32(pb, 0x7F);
avio_wb64(pb, 0);
avio_wb64(pb, 0);
avio_wb32(pb, 0);
avio_flush(pb);
return 0;
}
| 0
|
68,199
|
struct regmap *regulator_get_regmap(struct regulator *regulator)
{
struct regmap *map = regulator->rdev->regmap;
return map ? map : ERR_PTR(-EOPNOTSUPP);
}
| 0
|
135,447
|
static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen)
{
int ret = -ENOPROTOOPT;
#ifdef CONFIG_NETDEVICES
struct net *net = sock_net(sk);
char devname[IFNAMSIZ];
int index;
/* Sorry... */
ret = -EPERM;
if (!capable(CAP_NET_RAW))
goto out;
ret = -EINVAL;
if (optlen < 0)
goto out;
/* Bind this socket to a particular device like "eth0",
* as specified in the passed interface name. If the
* name is "" or the option length is zero the socket
* is not bound.
*/
if (optlen > IFNAMSIZ - 1)
optlen = IFNAMSIZ - 1;
memset(devname, 0, sizeof(devname));
ret = -EFAULT;
if (copy_from_user(devname, optval, optlen))
goto out;
index = 0;
if (devname[0] != '\0') {
struct net_device *dev;
rcu_read_lock();
dev = dev_get_by_name_rcu(net, devname);
if (dev)
index = dev->ifindex;
rcu_read_unlock();
ret = -ENODEV;
if (!dev)
goto out;
}
lock_sock(sk);
sk->sk_bound_dev_if = index;
sk_dst_reset(sk);
release_sock(sk);
ret = 0;
out:
#endif
return ret;
}
| 0
|
315,208
|
gfx::Rect OverlayWindowViews::CalculateAndUpdateWindowBounds() {
gfx::Rect work_area =
display::Screen::GetScreen()
->GetDisplayNearestWindow(
controller_->GetInitiatorWebContents()->GetTopLevelNativeWindow())
.work_area();
max_size_ = gfx::Size(work_area.width() / 2, work_area.height() / 2);
min_size_ = kMinWindowSize;
gfx::Size window_size = window_bounds_.size();
if (!has_been_shown_) {
window_size = gfx::Size(work_area.width() / 5, work_area.height() / 5);
window_size.set_width(std::min(
max_size_.width(), std::max(min_size_.width(), window_size.width())));
window_size.set_height(
std::min(max_size_.height(),
std::max(min_size_.height(), window_size.height())));
}
if (!window_size.IsEmpty() && !natural_size_.IsEmpty()) {
float aspect_ratio = (float)natural_size_.width() / natural_size_.height();
gfx::Rect window_rect(GetBounds().origin(), window_size);
views::WindowResizeUtils::SizeRectToAspectRatio(
views::HitTest::kBottomRight, aspect_ratio, min_size_, max_size_,
&window_rect);
window_size.SetSize(window_rect.width(), window_rect.height());
UpdateLayerBoundsWithLetterboxing(window_size);
}
gfx::Point origin = window_bounds_.origin();
int window_diff_width = work_area.right() - window_size.width();
int window_diff_height = work_area.bottom() - window_size.height();
int buffer = (window_diff_width + window_diff_height) / 2 * 0.02;
gfx::Point default_origin =
gfx::Point(window_diff_width - buffer, window_diff_height - buffer);
if (has_been_shown_) {
origin.SetToMin(default_origin);
} else {
origin = default_origin;
}
window_bounds_ = gfx::Rect(origin, window_size);
return window_bounds_;
}
| 0
|
79,873
|
static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
{
ctxt->dst.val = ctxt->src2.val;
return fastop(ctxt, em_imul);
}
| 0
|
78,862
|
R_API int r_anal_var_count_all(RAnalFunction *fcn) {
r_return_val_if_fail (fcn, 0);
return r_pvector_len (&fcn->vars);
}
| 0
|
91,402
|
//! Load gzipped image file, using external tool 'gunzip' \newinstance.
static CImg<T> get_load_gzip_external(const char *const filename) {
return CImg<T>().load_gzip_external(filename);
| 0
|
372,803
|
parse_auto_key_locate (char *options)
{
char *tok;
while ((tok = optsep (&options)))
{
struct akl *akl, *check, *last = NULL;
int dupe = 0;
if (tok[0] == '\0')
continue;
akl = xmalloc_clear (sizeof (*akl));
if (ascii_strcasecmp (tok, "nodefault") == 0)
akl->type = AKL_NODEFAULT;
else if (ascii_strcasecmp (tok, "local") == 0)
akl->type = AKL_LOCAL;
else if (ascii_strcasecmp (tok, "ldap") == 0)
akl->type = AKL_LDAP;
else if (ascii_strcasecmp (tok, "keyserver") == 0)
akl->type = AKL_KEYSERVER;
#ifdef USE_DNS_CERT
else if (ascii_strcasecmp (tok, "cert") == 0)
akl->type = AKL_CERT;
#endif
#ifdef USE_DNS_PKA
else if (ascii_strcasecmp (tok, "pka") == 0)
akl->type = AKL_PKA;
#endif
else if ((akl->spec = parse_keyserver_uri (tok, 1, NULL, 0)))
akl->type = AKL_SPEC;
else
{
free_akl (akl);
return 0;
}
/* We must maintain the order the user gave us */
for (check = opt.auto_key_locate; check;
last = check, check = check->next)
{
/* Check for duplicates */
if (check->type == akl->type
&& (akl->type != AKL_SPEC
|| (akl->type == AKL_SPEC
&& strcmp (check->spec->uri, akl->spec->uri) == 0)))
{
dupe = 1;
free_akl (akl);
break;
}
}
if (!dupe)
{
if (last)
last->next = akl;
else
opt.auto_key_locate = akl;
}
}
return 1;
}
| 0
|
256,738
|
static inline void set_num_731 ( unsigned char * p , uint32_t value ) {
archive_le32enc ( p , value ) ;
}
| 0
|
523,096
|
const char *end() const { return str + length + is_quoted(); }
| 0
|
135,088
|
const Model* ModelBuilder::BuildModel(
std::initializer_list<ModelBuilder::Tensor> inputs,
std::initializer_list<ModelBuilder::Tensor> outputs,
size_t num_subgraph_inputs) {
// Model schema requires an empty buffer at idx 0.
size_t buffer_size = 1 + ModelBuilder::nbr_of_metadata_buffers_;
flatbuffers::Offset<Buffer> buffers[kMaxMetadataBuffers];
buffers[0] = tflite::CreateBuffer(*builder_);
// Place the metadata buffers first in the buffer since the indices for them
// have already been set in AddMetadata()
for (int i = 1; i < ModelBuilder::nbr_of_metadata_buffers_ + 1; ++i) {
buffers[i] = metadata_buffers_[i - 1];
}
// TFLM only supports single subgraph.
constexpr size_t subgraphs_size = 1;
// Find out number of subgraph inputs.
if (num_subgraph_inputs == 0) {
// This is the default case.
num_subgraph_inputs = inputs.size();
} else {
// A non-zero value of num_subgraph_inputs means that some of
// the operator input tensors are not subgraph inputs.
TFLITE_DCHECK(num_subgraph_inputs < inputs.size());
}
const flatbuffers::Offset<SubGraph> subgraphs[subgraphs_size] = {
tflite::CreateSubGraph(
*builder_, builder_->CreateVector(tensors_, next_tensor_id_),
builder_->CreateVector(inputs.begin(), num_subgraph_inputs),
builder_->CreateVector(outputs.begin(), outputs.size()),
builder_->CreateVector(operators_, next_operator_id_),
builder_->CreateString("test_subgraph"))};
flatbuffers::Offset<Model> model_offset;
if (ModelBuilder::nbr_of_metadata_buffers_ > 0) {
model_offset = tflite::CreateModel(
*builder_, 0,
builder_->CreateVector(operator_codes_, next_operator_code_id_),
builder_->CreateVector(subgraphs, subgraphs_size),
builder_->CreateString("teset_model"),
builder_->CreateVector(buffers, buffer_size), 0,
builder_->CreateVector(metadata_,
ModelBuilder::nbr_of_metadata_buffers_));
} else {
model_offset = tflite::CreateModel(
*builder_, 0,
builder_->CreateVector(operator_codes_, next_operator_code_id_),
builder_->CreateVector(subgraphs, subgraphs_size),
builder_->CreateString("teset_model"),
builder_->CreateVector(buffers, buffer_size));
}
tflite::FinishModelBuffer(*builder_, model_offset);
void* model_pointer = builder_->GetBufferPointer();
const Model* model = flatbuffers::GetRoot<Model>(model_pointer);
return model;
}
| 0
|
350,869
|
static void set_error_response(h2_stream *stream, int http_status)
{
if (!h2_stream_is_ready(stream)) {
stream->rtmp->http_status = http_status;
}
}
| 1
|
31,548
|
static int rtrs_post_rdma_write_sg(struct rtrs_clt_con *con,
struct rtrs_clt_io_req *req,
struct rtrs_rbuf *rbuf, bool fr_en,
u32 size, u32 imm, struct ib_send_wr *wr,
struct ib_send_wr *tail)
{
struct rtrs_clt_path *clt_path = to_clt_path(con->c.path);
struct ib_sge *sge = req->sge;
enum ib_send_flags flags;
struct scatterlist *sg;
size_t num_sge;
int i;
struct ib_send_wr *ptail = NULL;
if (fr_en) {
i = 0;
sge[i].addr = req->mr->iova;
sge[i].length = req->mr->length;
sge[i].lkey = req->mr->lkey;
i++;
num_sge = 2;
ptail = tail;
} else {
for_each_sg(req->sglist, sg, req->sg_cnt, i) {
sge[i].addr = sg_dma_address(sg);
sge[i].length = sg_dma_len(sg);
sge[i].lkey = clt_path->s.dev->ib_pd->local_dma_lkey;
}
num_sge = 1 + req->sg_cnt;
}
sge[i].addr = req->iu->dma_addr;
sge[i].length = size;
sge[i].lkey = clt_path->s.dev->ib_pd->local_dma_lkey;
/*
* From time to time we have to post signalled sends,
* or send queue will fill up and only QP reset can help.
*/
flags = atomic_inc_return(&con->c.wr_cnt) % clt_path->s.signal_interval ?
0 : IB_SEND_SIGNALED;
ib_dma_sync_single_for_device(clt_path->s.dev->ib_dev,
req->iu->dma_addr,
size, DMA_TO_DEVICE);
return rtrs_iu_post_rdma_write_imm(&con->c, req->iu, sge, num_sge,
rbuf->rkey, rbuf->addr, imm,
flags, wr, ptail);
}
| 0
|
45,060
|
error_t webSocketFormatErrorResponse(WebSocket *webSocket,
uint_t statusCode, const char_t *message)
{
uint_t i;
size_t length;
char_t *p;
WebSocketFrameContext *txContext;
//HTML response template
static const char_t template[] =
"<!doctype html>\r\n"
"<html>\r\n"
"<head><title>Error %03d</title></head>\r\n"
"<body>\r\n"
"<h2>Error %03d</h2>\r\n"
"<p>%s</p>\r\n"
"</body>\r\n"
"</html>\r\n";
//Point to the TX context
txContext = &webSocket->txContext;
//Point to the buffer where to format the client's handshake
p = (char_t *) txContext->buffer;
//The first line of a response message is the Status-Line, consisting
//of the protocol version followed by a numeric status code and its
//associated textual phrase
p += osSprintf(p, "HTTP/%u.%u %u ", MSB(webSocket->handshakeContext.version),
LSB(webSocket->handshakeContext.version), statusCode);
//Retrieve the Reason-Phrase that corresponds to the Status-Code
for(i = 0; i < arraysize(statusCodeList); i++)
{
//Check the status code
if(statusCodeList[i].value == statusCode)
{
//Append the textual phrase to the Status-Line
p += osSprintf(p, statusCodeList[i].message);
//Break the loop and continue processing
break;
}
}
//Properly terminate the Status-Line
p += osSprintf(p, "\r\n");
//Content type
p += osSprintf(p, "Content-Type: %s\r\n", "text/html");
//Compute the length of the response
length = osStrlen(template) + osStrlen(message) - 4;
//Set Content-Length field
p += osSprintf(p, "Content-Length: %" PRIuSIZE "\r\n", length);
//Terminate the header with an empty line
p += osSprintf(p, "\r\n");
//Format HTML response
p += osSprintf(p, template, statusCode, statusCode, message);
//Rewind to the beginning of the buffer
txContext->bufferPos = 0;
//Update the number of data buffered but not yet sent
txContext->bufferLen = osStrlen((char_t *) txContext->buffer);
//Successful processing
return NO_ERROR;
}
| 0
|
189,943
|
void BookmarksAPI::Shutdown() {
ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
}
| 0
|
474,378
|
*LUKS2_keyslot_handler(struct crypt_device *cd, int keyslot)
{
struct luks2_hdr *hdr;
json_object *jobj1, *jobj2;
if (keyslot < 0)
return NULL;
if (!(hdr = crypt_get_hdr(cd, CRYPT_LUKS2)))
return NULL;
if (!(jobj1 = LUKS2_get_keyslot_jobj(hdr, keyslot)))
return NULL;
if (!json_object_object_get_ex(jobj1, "type", &jobj2))
return NULL;
return LUKS2_keyslot_handler_type(cd, json_object_get_string(jobj2));
}
| 0
|
518,530
|
Field_longlong(uint32 len_arg,bool maybe_null_arg,
const LEX_CSTRING *field_name_arg,
bool unsigned_arg)
:Field_int((uchar*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, 0, unsigned_arg)
{}
| 0
|
470,510
|
read_name_from_file (struct cpio_file_stat *file_hdr, int fd, uintmax_t len)
{
if (len == 0)
{
error (0, 0, _("malformed header: file name of zero length"));
}
else
{
cpio_realloc_c_name (file_hdr, len);
tape_buffered_read (file_hdr->c_name, fd, len);
if (file_hdr->c_name[len-1] != 0)
{
error (0, 0, _("malformed header: file name is not nul-terminated"));
/* Skip this file */
len = 0;
}
}
file_hdr->c_namesize = len;
}
| 0
|
176,072
|
CheckUserAuthorization(void)
{
#ifdef USE_PAM
static struct pam_conv conv = {
misc_conv,
NULL
};
pam_handle_t *pamh = NULL;
struct passwd *pw;
int retval;
if (getuid() != geteuid()) {
pw = getpwuid(getuid());
if (pw == NULL)
FatalError("getpwuid() failed for uid %d\n", getuid());
retval = pam_start("xserver", pw->pw_name, &conv, &pamh);
if (retval != PAM_SUCCESS)
FatalError("pam_start() failed.\n"
"\tMissing or mangled PAM config file or module?\n");
retval = pam_authenticate(pamh, 0);
if (retval != PAM_SUCCESS) {
pam_end(pamh, retval);
FatalError("PAM authentication failed, cannot start X server.\n"
"\tPerhaps you do not have console ownership?\n");
}
retval = pam_acct_mgmt(pamh, 0);
if (retval != PAM_SUCCESS) {
pam_end(pamh, retval);
FatalError("PAM authentication failed, cannot start X server.\n"
"\tPerhaps you do not have console ownership?\n");
}
/* this is not a session, so do not do session management */
pam_end(pamh, PAM_SUCCESS);
}
#endif
}
| 0
|
381,555
|
HttpTransact::HandleResponse(State* s)
{
DebugTxn("http_trans", "[HttpTransact::HandleResponse]");
DebugTxn("http_seq", "[HttpTransact::HandleResponse] Response received");
s->source = SOURCE_HTTP_ORIGIN_SERVER;
s->response_received_time = ink_cluster_time();
ink_assert(s->response_received_time >= s->request_sent_time);
s->current.now = s->response_received_time;
DebugTxn("http_trans", "[HandleResponse] response_received_time: %" PRId64, (int64_t)s->response_received_time);
if (!s->cop_test_page)
DUMP_HEADER("http_hdrs", &s->hdr_info.server_response, s->state_machine_id, "Incoming O.S. Response");
HTTP_INCREMENT_TRANS_STAT(http_incoming_responses_stat);
ink_release_assert(s->current.request_to != UNDEFINED_LOOKUP);
if (s->cache_info.action != CACHE_DO_WRITE) {
ink_release_assert(s->cache_info.action != CACHE_DO_LOOKUP);
ink_release_assert(s->cache_info.action != CACHE_DO_SERVE);
ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_DELETE);
ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_UPDATE);
ink_release_assert(s->cache_info.action != CACHE_PREPARE_TO_WRITE);
}
if (!is_response_valid(s, &s->hdr_info.server_response)) {
DebugTxn("http_seq", "[HttpTransact::HandleResponse] Response not valid");
} else {
DebugTxn("http_seq", "[HttpTransact::HandleResponse] Response valid");
initialize_state_variables_from_response(s, &s->hdr_info.server_response);
}
switch (s->current.request_to) {
case ICP_SUGGESTED_HOST:
handle_response_from_icp_suggested_host(s);
break;
case PARENT_PROXY:
handle_response_from_parent(s);
break;
case ORIGIN_SERVER:
handle_response_from_server(s);
break;
default:
ink_assert(!("s->current.request_to is not ICP, P.P. or O.S. - hmmm."));
break;
}
return;
}
| 0
|
1,116
|
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , ClosedWhileHidden_Http ) {
StartHttpServer ( ) ;
base : : TimeDelta upper_bound = NavigateInForegroundAndCloseInBackgroundWithTiming ( http_test_server_ -> GetURL ( "/simple.html" ) ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ;
int32_t bucket_min = histogram_tester_ . GetAllSamples ( internal : : kHttpEngagementHistogram ) [ 0 ] . min ;
EXPECT_GE ( upper_bound . InMilliseconds ( ) , bucket_min ) ;
EXPECT_LT ( 0 , bucket_min ) ;
}
| 1
|
373,917
|
bool moreJSObjs() const {
return nextjsobj != 0;
}
| 0
|
514,327
|
static void test_message_parser_trailing_dashes(void)
{
static const char input_msg[] =
"Content-Type: multipart/mixed; boundary=\"a--\"\n"
"\n"
"--a--\n"
"Content-Type: multipart/mixed; boundary=\"a----\"\n"
"\n"
"--a----\n"
"Content-Type: text/plain\n"
"\n"
"body\n"
"--a------\n"
"Content-Type: text/html\n"
"\n"
"body2\n"
"--a----";
struct istream *input;
struct message_part *parts;
pool_t pool;
test_begin("message parser trailing dashes");
pool = pool_alloconly_create("message parser", 10240);
input = test_istream_create(input_msg);
test_assert(message_parse_stream(pool, input, &set_empty, FALSE, &parts) < 0);
test_assert(parts->children_count == 2);
test_assert(parts->children->next == NULL);
test_assert(parts->children->children_count == 1);
test_assert(parts->children->children->next == NULL);
test_assert(parts->children->children->children_count == 0);
test_parsed_parts(input, parts);
i_stream_unref(&input);
pool_unref(&pool);
test_end();
}
| 0
|
280,526
|
static int _hid_get_string_descriptor(struct hid_device_priv* dev, int _index,
| 0
|
513,825
|
napi_status napi_get_all_property_names(napi_env env,
napi_value object,
napi_key_collection_mode key_mode,
napi_key_filter key_filter,
napi_key_conversion key_conversion,
napi_value* result) {
NAPI_PREAMBLE(env);
CHECK_ARG(env, result);
v8::Local<v8::Context> context = env->context();
v8::Local<v8::Object> obj;
CHECK_TO_OBJECT(env, context, obj, object);
v8::PropertyFilter filter = v8::PropertyFilter::ALL_PROPERTIES;
if (key_filter & napi_key_writable) {
filter =
static_cast<v8::PropertyFilter>(filter |
v8::PropertyFilter::ONLY_WRITABLE);
}
if (key_filter & napi_key_enumerable) {
filter =
static_cast<v8::PropertyFilter>(filter |
v8::PropertyFilter::ONLY_ENUMERABLE);
}
if (key_filter & napi_key_configurable) {
filter =
static_cast<v8::PropertyFilter>(filter |
v8::PropertyFilter::ONLY_WRITABLE);
}
if (key_filter & napi_key_skip_strings) {
filter =
static_cast<v8::PropertyFilter>(filter |
v8::PropertyFilter::SKIP_STRINGS);
}
if (key_filter & napi_key_skip_symbols) {
filter =
static_cast<v8::PropertyFilter>(filter |
v8::PropertyFilter::SKIP_SYMBOLS);
}
v8::KeyCollectionMode collection_mode;
v8::KeyConversionMode conversion_mode;
switch (key_mode) {
case napi_key_include_prototypes:
collection_mode = v8::KeyCollectionMode::kIncludePrototypes;
break;
case napi_key_own_only:
collection_mode = v8::KeyCollectionMode::kOwnOnly;
break;
default:
return napi_set_last_error(env, napi_invalid_arg);
}
switch (key_conversion) {
case napi_key_keep_numbers:
conversion_mode = v8::KeyConversionMode::kKeepNumbers;
break;
case napi_key_numbers_to_strings:
conversion_mode = v8::KeyConversionMode::kConvertToString;
break;
default:
return napi_set_last_error(env, napi_invalid_arg);
}
v8::MaybeLocal<v8::Array> maybe_all_propertynames =
obj->GetPropertyNames(context,
collection_mode,
filter,
v8::IndexFilter::kIncludeIndices,
conversion_mode);
CHECK_MAYBE_EMPTY_WITH_PREAMBLE(
env, maybe_all_propertynames, napi_generic_failure);
*result =
v8impl::JsValueFromV8LocalValue(maybe_all_propertynames.ToLocalChecked());
return GET_RETURN_STATUS(env);
}
| 0
|
169,911
|
void RenderProcessHostImpl::UnregisterAecDumpConsumerOnUIThread(int id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (std::vector<int>::iterator it = aec_dump_consumers_.begin();
it != aec_dump_consumers_.end(); ++it) {
if (*it == id) {
aec_dump_consumers_.erase(it);
break;
}
}
}
| 0
|
263,650
|
static int acm_wb_alloc(struct acm *acm)
{
int i, wbn;
struct acm_wb *wb;
wbn = 0;
i = 0;
for (;;) {
wb = &acm->wb[wbn];
if (!wb->use) {
wb->use = 1;
return wbn;
}
wbn = (wbn + 1) % ACM_NW;
if (++i >= ACM_NW)
return -1;
}
}
| 0
|
173,257
|
bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
{
if (!layoutObject())
return false;
LayoutObject* o = layoutObject();
if (!o->isInline() || o->isReplaced()) {
point = o->localToAbsolute(FloatPoint(), UseTransforms);
return true;
}
while (o) {
LayoutObject* p = o;
if (LayoutObject* oFirstChild = o->slowFirstChild()) {
o = oFirstChild;
} else if (o->nextSibling()) {
o = o->nextSibling();
} else {
LayoutObject* next = nullptr;
while (!next && o->parent()) {
o = o->parent();
next = o->nextSibling();
}
o = next;
if (!o)
break;
}
ASSERT(o);
if (!o->isInline() || o->isReplaced()) {
point = o->localToAbsolute(FloatPoint(), UseTransforms);
return true;
}
if (p->node() && p->node() == this && o->isText() && !o->isBR() && !toLayoutText(o)->hasTextBoxes()) {
} else if ((o->isText() && !o->isBR()) || o->isReplaced()) {
point = FloatPoint();
if (o->isText() && toLayoutText(o)->firstTextBox()) {
point.move(toLayoutText(o)->linesBoundingBox().x(), toLayoutText(o)->firstTextBox()->root().lineTop().toFloat());
point = o->localToAbsolute(point, UseTransforms);
} else if (o->isBox()) {
LayoutBox* box = toLayoutBox(o);
point.moveBy(box->location());
point = o->container()->localToAbsolute(point, UseTransforms);
}
return true;
}
}
if (!o && document().view()) {
point = FloatPoint(0, document().view()->contentsHeight());
return true;
}
return false;
}
| 0
|
513,853
|
static UINT cliprdr_server_monitor_ready(CliprdrServerContext* context,
const CLIPRDR_MONITOR_READY* monitorReady)
{
wStream* s;
CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*)context->handle;
if (monitorReady->msgType != CB_MONITOR_READY)
WLog_WARN(TAG, "[%s] called with invalid type %08" PRIx32, __FUNCTION__,
monitorReady->msgType);
s = cliprdr_packet_new(CB_MONITOR_READY, monitorReady->msgFlags, monitorReady->dataLen);
if (!s)
{
WLog_ERR(TAG, "cliprdr_packet_new failed!");
return ERROR_INTERNAL_ERROR;
}
WLog_DBG(TAG, "ServerMonitorReady");
return cliprdr_server_packet_send(cliprdr, s);
}
| 0
|
129,110
|
cockpit_web_response_get_state (CockpitWebResponse *self)
{
g_return_val_if_fail (COCKPIT_IS_WEB_RESPONSE (self), 0);
if (self->done)
return COCKPIT_WEB_RESPONSE_SENT;
else if (self->complete)
return COCKPIT_WEB_RESPONSE_COMPLETE;
else if (self->count == 0)
return COCKPIT_WEB_RESPONSE_READY;
else
return COCKPIT_WEB_RESPONSE_QUEUING;
}
| 0
|
343,065
|
void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque)
{
VMStateField *field = vmsd->fields;
if (vmsd->pre_save) {
vmsd->pre_save(opaque);
while (field->name) {
if (!field->field_exists ||
field->field_exists(opaque, vmsd->version_id)) {
void *base_addr = vmstate_base_addr(opaque, field);
int i, n_elems = vmstate_n_elems(opaque, field);
int size = vmstate_size(opaque, field);
for (i = 0; i < n_elems; i++) {
void *addr = base_addr + size * i;
if (field->flags & VMS_ARRAY_OF_POINTER) {
addr = *(void **)addr;
if (field->flags & VMS_STRUCT) {
vmstate_save_state(f, field->vmsd, addr);
field->info->put(f, addr, size);
field++;
vmstate_subsection_save(f, vmsd, opaque);
| 1
|
99,555
|
static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *_std)
{
v4l2_std_id req_std = 0, supported_std = 0;
const v4l2_std_id all_std = V4L2_STD_ALL, no_std = 0;
if (_std) {
req_std = *_std;
*_std = all_std;
}
/* we support everything in V4L2_STD_ALL, but not more... */
supported_std = (all_std & req_std);
if (no_std == supported_std)
return -EINVAL;
return 0;
}
| 0
|
471,081
|
cleanhostname(char *host)
{
if (*host == '[' && host[strlen(host) - 1] == ']') {
host[strlen(host) - 1] = '\0';
return (host + 1);
} else
return host;
}
| 0
|
131,258
|
void sqlite3VdbeRewind(Vdbe *p){
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
int i;
#endif
assert( p!=0 );
assert( p->magic==VDBE_MAGIC_INIT || p->magic==VDBE_MAGIC_RESET );
/* There should be at least one opcode.
*/
assert( p->nOp>0 );
/* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
p->magic = VDBE_MAGIC_RUN;
#ifdef SQLITE_DEBUG
for(i=0; i<p->nMem; i++){
assert( p->aMem[i].db==p->db );
}
#endif
p->pc = -1;
p->rc = SQLITE_OK;
p->errorAction = OE_Abort;
p->nChange = 0;
p->cacheCtr = 1;
p->minWriteFileFormat = 255;
p->iStatement = 0;
p->nFkConstraint = 0;
#ifdef VDBE_PROFILE
for(i=0; i<p->nOp; i++){
p->aOp[i].cnt = 0;
p->aOp[i].cycles = 0;
}
#endif
}
| 0
|
127,944
|
process_brushcache(STREAM s, uint16 flags)
{
UNUSED(flags);
BRUSHDATA brush_data;
uint8 cache_idx, colour_code, width, height, size, type;
uint8 *comp_brush;
int index;
int Bpp;
in_uint8(s, cache_idx);
in_uint8(s, colour_code);
in_uint8(s, width);
in_uint8(s, height);
in_uint8(s, type); /* type, 0x8x = cached */
in_uint8(s, size);
logger(Graphics, Debug, "process_brushcache(), idx=%d, wd=%d, ht=%d, type=0x%x sz=%d",
cache_idx, width, height, type, size);
if ((width == 8) && (height == 8))
{
if (colour_code == 1)
{
brush_data.colour_code = 1;
brush_data.data_size = 8;
brush_data.data = xmalloc(8);
if (size == 8)
{
/* read it bottom up */
for (index = 7; index >= 0; index--)
{
in_uint8(s, brush_data.data[index]);
}
}
else
{
logger(Graphics, Warning,
"process_brushcache(), incompatible brush, colour_code %d size %d",
colour_code, size);
}
cache_put_brush_data(1, cache_idx, &brush_data);
}
else if ((colour_code >= 3) && (colour_code <= 6))
{
Bpp = colour_code - 2;
brush_data.colour_code = colour_code;
brush_data.data_size = 8 * 8 * Bpp;
brush_data.data = xmalloc(8 * 8 * Bpp);
if (size == 16 + 4 * Bpp)
{
in_uint8p(s, comp_brush, 16 + 4 * Bpp);
process_compressed_8x8_brush_data(comp_brush, brush_data.data, Bpp);
}
else
{
in_uint8a(s, brush_data.data, 8 * 8 * Bpp);
}
cache_put_brush_data(colour_code, cache_idx, &brush_data);
}
else
{
logger(Graphics, Warning,
"process_brushcache(), incompatible brush, colour_code %d size %d",
colour_code, size);
}
}
else
{
logger(Graphics, Warning,
"process_brushcache(), incompatible brush, width height %d %d", width,
height);
}
}
| 0
|
70,301
|
static void vfio_bar_quirk_teardown(VFIOPCIDevice *vdev, int nr)
{
VFIOBAR *bar = &vdev->bars[nr];
while (!QLIST_EMPTY(&bar->quirks)) {
VFIOQuirk *quirk = QLIST_FIRST(&bar->quirks);
memory_region_del_subregion(&bar->region.mem, &quirk->mem);
object_unparent(OBJECT(&quirk->mem));
QLIST_REMOVE(quirk, next);
g_free(quirk);
}
}
| 0
|
217,590
|
void GLES2Implementation::ResizeCHROMIUM(GLuint width,
GLuint height,
float scale_factor,
GLenum color_space,
GLboolean alpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResizeCHROMIUM(" << width << ", "
<< height << ", " << scale_factor << ", " << alpha << ")");
helper_->ResizeCHROMIUM(width, height, scale_factor, color_space, alpha);
CheckGLError();
}
| 0
|
431,471
|
Status AuthorizationManagerImpl::_fetchUserV2(OperationContext* opCtx,
const UserName& userName,
std::unique_ptr<User>* acquiredUser) {
BSONObj userObj;
Status status = getUserDescription(opCtx, userName, &userObj);
if (!status.isOK()) {
return status;
}
// Put the new user into an unique_ptr temporarily in case there's an error while
// initializing the user.
auto user = stdx::make_unique<User>(userName);
status = _initializeUserFromPrivilegeDocument(user.get(), userObj);
if (!status.isOK()) {
return status;
}
acquiredUser->reset(user.release());
return Status::OK();
}
| 0
|
378,301
|
static int selinux_inode_setsecurity(struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
struct inode_security_struct *isec = inode->i_security;
u32 newsid;
int rc;
if (strcmp(name, XATTR_SELINUX_SUFFIX))
return -EOPNOTSUPP;
if (!value || !size)
return -EACCES;
rc = security_context_to_sid((void *)value, size, &newsid, GFP_KERNEL);
if (rc)
return rc;
isec->sclass = inode_mode_to_security_class(inode->i_mode);
isec->sid = newsid;
isec->initialized = 1;
return 0;
}
| 0
|
383,858
|
PHP_METHOD(Phar, extractTo)
{
char *error = NULL;
php_stream *fp;
php_stream_statbuf ssb;
phar_entry_info *entry;
char *pathto, *filename, *actual;
int pathto_len, filename_len;
int ret, i;
int nelems;
zval *zval_files = NULL;
zend_bool overwrite = 0;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
return;
}
fp = php_stream_open_wrapper(phar_obj->arc.archive->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK, &actual);
if (!fp) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
"Invalid argument, %s cannot be found", phar_obj->arc.archive->fname);
return;
}
efree(actual);
php_stream_close(fp);
if (pathto_len < 1) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
"Invalid argument, extraction path must be non-zero length");
return;
}
if (pathto_len >= MAXPATHLEN) {
char *tmp = estrndup(pathto, 50);
/* truncate for error message */
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Cannot extract to \"%s...\", destination directory is too long for filesystem", tmp);
efree(tmp);
return;
}
if (php_stream_stat_path(pathto, &ssb) < 0) {
ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL);
if (!ret) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to create path \"%s\" for extraction", pathto);
return;
}
} else if (!(ssb.sb.st_mode & S_IFDIR)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC,
"Unable to use path \"%s\" for extraction, it is a file, must be a directory", pathto);
return;
}
if (zval_files) {
switch (Z_TYPE_P(zval_files)) {
case IS_NULL:
goto all_files;
case IS_STRING:
filename = Z_STRVAL_P(zval_files);
filename_len = Z_STRLEN_P(zval_files);
break;
case IS_ARRAY:
nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files));
if (nelems == 0 ) {
RETURN_FALSE;
}
for (i = 0; i < nelems; i++) {
zval **zval_file;
if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) {
switch (Z_TYPE_PP(zval_file)) {
case IS_STRING:
break;
default:
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
"Invalid argument, array of filenames to extract contains non-string value");
return;
}
if (FAILURE == zend_hash_find(&phar_obj->arc.archive->manifest, Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file), (void **)&entry)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
"Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", Z_STRVAL_PP(zval_file), phar_obj->arc.archive->fname);
}
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
"Extraction from phar \"%s\" failed: %s", phar_obj->arc.archive->fname, error);
efree(error);
return;
}
}
}
RETURN_TRUE;
default:
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC,
"Invalid argument, expected a filename (string) or array of filenames");
return;
}
if (FAILURE == zend_hash_find(&phar_obj->arc.archive->manifest, filename, filename_len, (void **)&entry)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
"Phar Error: attempted to extract non-existent file \"%s\" from phar \"%s\"", filename, phar_obj->arc.archive->fname);
return;
}
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
"Extraction from phar \"%s\" failed: %s", phar_obj->arc.archive->fname, error);
efree(error);
return;
}
} else {
phar_archive_data *phar;
all_files:
phar = phar_obj->arc.archive;
/* Extract all files */
if (!zend_hash_num_elements(&(phar->manifest))) {
RETURN_TRUE;
}
for (zend_hash_internal_pointer_reset(&phar->manifest);
zend_hash_has_more_elements(&phar->manifest) == SUCCESS;
zend_hash_move_forward(&phar->manifest)) {
if (zend_hash_get_current_data(&phar->manifest, (void **)&entry) == FAILURE) {
continue;
}
if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error TSRMLS_CC)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC,
"Extraction from phar \"%s\" failed: %s", phar->fname, error);
efree(error);
return;
}
}
}
RETURN_TRUE;
}
| 0
|
500,391
|
QPDFAcroFormDocumentHelper::getFormFields()
{
analyze();
std::vector<QPDFFormFieldObjectHelper> result;
for (std::map<QPDFObjGen,
std::vector<QPDFAnnotationObjectHelper> >::iterator iter =
this->m->field_to_annotations.begin();
iter != this->m->field_to_annotations.end(); ++iter)
{
result.push_back(this->qpdf.getObjectByObjGen((*iter).first));
}
return result;
}
| 0
|
274,999
|
cockpit_auth_steal_authorization (GHashTable *headers,
GIOStream *connection,
gchar **ret_type,
gchar **ret_conversation)
{
char *type = NULL;
gchar *ret = NULL;
gchar *line;
gpointer key;
g_assert (headers != NULL);
g_assert (ret_conversation != NULL);
g_assert (ret_type != NULL);
/* Avoid copying as it can contain passwords */
if (g_hash_table_lookup_extended (headers, "Authorization", &key, (gpointer *)&line))
{
g_hash_table_steal (headers, "Authorization");
g_free (key);
}
else
{
/*
* If we don't yet know that Negotiate authentication is possible
* or not, then we ask our session to try to do Negotiate auth
* but without any input data.
*/
if (gssapi_available != 0)
line = g_strdup ("Negotiate");
else
return NULL;
}
/* Dig out the authorization type */
if (!cockpit_authorize_type (line, &type))
goto out;
/* If this is a conversation, get that part out too */
if (g_str_equal (type, "x-conversation"))
{
if (!cockpit_authorize_subject (line, ret_conversation))
goto out;
}
/*
* So for negotiate authentication, conversation happens on a
* single connection. Yes that's right, GSSAPI, NTLM, and all
* those nice mechanisms are keep-alive based, not HTTP request based.
*/
else if (g_str_equal (type, "negotiate"))
{
/* Resume an already running conversation? */
if (ret_conversation && connection)
*ret_conversation = g_strdup (g_object_get_data (G_OBJECT (connection), type));
}
if (ret_type)
{
*ret_type = type;
type = NULL;
}
ret = line;
line = NULL;
out:
g_free (line);
g_free (type);
return ret;
}
| 0
|
345,958
|
bool asn1_check_enumerated(struct asn1_data *data, int v)
{
uint8_t b;
if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false;
asn1_read_uint8(data, &b);
asn1_end_tag(data);
if (v != b)
data->has_error = false;
return !data->has_error;
}
| 1
|
509,560
|
static int tls_construct_cke_gost(SSL *s, unsigned char **p, int *len, int *al)
{
#ifndef OPENSSL_NO_GOST
/* GOST key exchange message creation */
EVP_PKEY_CTX *pkey_ctx = NULL;
X509 *peer_cert;
size_t msglen;
unsigned int md_len;
unsigned char shared_ukm[32], tmp[256];
EVP_MD_CTX *ukm_hash = NULL;
int dgst_nid = NID_id_GostR3411_94;
unsigned char *pms = NULL;
size_t pmslen = 0;
if ((s->s3->tmp.new_cipher->algorithm_auth & SSL_aGOST12) != 0)
dgst_nid = NID_id_GostR3411_2012_256;
/*
* Get server sertificate PKEY and create ctx from it
*/
peer_cert = s->session->peer;
if (!peer_cert) {
*al = SSL_AD_HANDSHAKE_FAILURE;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST,
SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER);
return 0;
}
pkey_ctx = EVP_PKEY_CTX_new(X509_get0_pubkey(peer_cert), NULL);
if (pkey_ctx == NULL) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_MALLOC_FAILURE);
return 0;
}
/*
* If we have send a certificate, and certificate key
* parameters match those of server certificate, use
* certificate key for key exchange
*/
/* Otherwise, generate ephemeral key pair */
pmslen = 32;
pms = OPENSSL_malloc(pmslen);
if (pms == NULL) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_MALLOC_FAILURE);
goto err;
}
if (EVP_PKEY_encrypt_init(pkey_ctx) <= 0
/* Generate session key */
|| RAND_bytes(pms, pmslen) <= 0) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_INTERNAL_ERROR);
goto err;
};
/*
* Compute shared IV and store it in algorithm-specific context
* data
*/
ukm_hash = EVP_MD_CTX_new();
if (ukm_hash == NULL
|| EVP_DigestInit(ukm_hash, EVP_get_digestbynid(dgst_nid)) <= 0
|| EVP_DigestUpdate(ukm_hash, s->s3->client_random,
SSL3_RANDOM_SIZE) <= 0
|| EVP_DigestUpdate(ukm_hash, s->s3->server_random,
SSL3_RANDOM_SIZE) <= 0
|| EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len) <= 0) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_INTERNAL_ERROR);
goto err;
}
EVP_MD_CTX_free(ukm_hash);
ukm_hash = NULL;
if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, EVP_PKEY_OP_ENCRYPT,
EVP_PKEY_CTRL_SET_IV, 8, shared_ukm) < 0) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, SSL_R_LIBRARY_BUG);
goto err;
}
/* Make GOST keytransport blob message */
/*
* Encapsulate it into sequence
*/
*((*p)++) = V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED;
msglen = 255;
if (EVP_PKEY_encrypt(pkey_ctx, tmp, &msglen, pms, pmslen) <= 0) {
*al = SSL_AD_INTERNAL_ERROR;
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, SSL_R_LIBRARY_BUG);
goto err;
}
if (msglen >= 0x80) {
*((*p)++) = 0x81;
*((*p)++) = msglen & 0xff;
*len = msglen + 3;
} else {
*((*p)++) = msglen & 0xff;
*len = msglen + 2;
}
memcpy(*p, tmp, msglen);
EVP_PKEY_CTX_free(pkey_ctx);
s->s3->tmp.pms = pms;
s->s3->tmp.pmslen = pmslen;
return 1;
err:
EVP_PKEY_CTX_free(pkey_ctx);
OPENSSL_clear_free(pms, pmslen);
EVP_MD_CTX_free(ukm_hash);
return 0;
#else
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_INTERNAL_ERROR);
*al = SSL_AD_INTERNAL_ERROR;
return 0;
#endif
}
| 0
|
380,203
|
static int ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
return zend_fetch_var_address_helper_SPEC_TMP(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
}
| 0
|
284,753
|
bool RenderFrameImpl::IsEncryptedMediaEnabled() const {
return GetRendererPreferences().enable_encrypted_media;
}
| 0
|
467,192
|
RGWOp *RGWHandler_REST_Bucket_SWIFT::op_options()
{
return new RGWOptionsCORS_ObjStore_SWIFT;
}
| 0
|
356,820
|
static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
{
struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
if (nla_put(skb, attrtype, 0, NULL) < 0)
return NULL;
return start;
}
| 0
|
375,179
|
_equalWindowDef(const WindowDef *a, const WindowDef *b)
{
COMPARE_STRING_FIELD(name);
COMPARE_STRING_FIELD(refname);
COMPARE_NODE_FIELD(partitionClause);
COMPARE_NODE_FIELD(orderClause);
COMPARE_SCALAR_FIELD(frameOptions);
COMPARE_NODE_FIELD(startOffset);
COMPARE_NODE_FIELD(endOffset);
COMPARE_LOCATION_FIELD(location);
return true;
}
| 0
|
328,478
|
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
{
DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
int line, oops = 0;
int bpp = surface_bits_per_pixel(surface);
int linesize = surface_stride(surface);
uint8_t *data = surface_data(surface);
if (!is_buffer_shared(surface)) {
switch (xenfb->depth) {
case 8:
if (bpp == 16) {
BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5);
} else if (bpp == 32) {
BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8);
} else {
oops = 1;
}
break;
case 24:
if (bpp == 16) {
BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5);
} else if (bpp == 32) {
BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8);
} else {
oops = 1;
}
break;
default:
oops = 1;
}
}
if (oops) /* should not happen */
xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n",
__FUNCTION__, xenfb->depth, bpp);
dpy_gfx_update(xenfb->c.con, x, y, w, h);
}
| 0
|
492,444
|
IntVal(int32_t val) : val(val) {}
| 0
|
446,500
|
virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
virDomainHostdevSubsysSCSIPtr scsisrc)
{
bool got_address = false, got_adapter = false;
xmlNodePtr cur;
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
g_autofree char *bus = NULL;
g_autofree char *target = NULL;
g_autofree char *unit = NULL;
cur = sourcenode->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
if (virXMLNodeNameEqual(cur, "address")) {
if (got_address) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("more than one source addresses is "
"specified for scsi hostdev"));
return -1;
}
if (!(bus = virXMLPropString(cur, "bus")) ||
!(target = virXMLPropString(cur, "target")) ||
!(unit = virXMLPropString(cur, "unit"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'bus', 'target', and 'unit' must be specified "
"for scsi hostdev source address"));
return -1;
}
if (virStrToLong_uip(bus, NULL, 0, &scsihostsrc->bus) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse bus '%s'"), bus);
return -1;
}
if (virStrToLong_uip(target, NULL, 0,
&scsihostsrc->target) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse target '%s'"), target);
return -1;
}
if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse unit '%s'"), unit);
return -1;
}
got_address = true;
} else if (virXMLNodeNameEqual(cur, "adapter")) {
if (got_adapter) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("more than one adapters is specified "
"for scsi hostdev source"));
return -1;
}
if (!(scsihostsrc->adapter = virXMLPropString(cur, "name"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'adapter' must be specified for scsi hostdev source"));
return -1;
}
got_adapter = true;
} else {
virReportError(VIR_ERR_XML_ERROR,
_("unsupported element '%s' of scsi hostdev source"),
cur->name);
return -1;
}
}
cur = cur->next;
}
if (!got_address || !got_adapter) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'adapter' and 'address' must be specified for scsi "
"hostdev source"));
return -1;
}
return 0;
}
| 0
|
476,150
|
void InstanceKlass::call_class_initializer(TRAPS) {
if (ReplayCompiles &&
(ReplaySuppressInitializers == 1 ||
(ReplaySuppressInitializers >= 2 && class_loader() != NULL))) {
// Hide the existence of the initializer for the purpose of replaying the compile
return;
}
methodHandle h_method(THREAD, class_initializer());
assert(!is_initialized(), "we cannot initialize twice");
LogTarget(Info, class, init) lt;
if (lt.is_enabled()) {
ResourceMark rm(THREAD);
LogStream ls(lt);
ls.print("%d Initializing ", call_class_initializer_counter++);
name()->print_value_on(&ls);
ls.print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this));
}
if (h_method() != NULL) {
JavaCallArguments args; // No arguments
JavaValue result(T_VOID);
JavaCalls::call(&result, h_method, &args, CHECK); // Static call (no args)
}
}
| 0
|
77,718
|
load_inst(UnpicklerObject *self)
{
PyObject *cls = NULL;
PyObject *args = NULL;
PyObject *obj = NULL;
PyObject *module_name;
PyObject *class_name;
Py_ssize_t len;
Py_ssize_t i;
char *s;
if ((i = marker(self)) < 0)
return -1;
if ((len = _Unpickler_Readline(self, &s)) < 0)
return -1;
if (len < 2)
return bad_readline();
/* Here it is safe to use PyUnicode_DecodeASCII(), even though non-ASCII
identifiers are permitted in Python 3.0, since the INST opcode is only
supported by older protocols on Python 2.x. */
module_name = PyUnicode_DecodeASCII(s, len - 1, "strict");
if (module_name == NULL)
return -1;
if ((len = _Unpickler_Readline(self, &s)) >= 0) {
if (len < 2) {
Py_DECREF(module_name);
return bad_readline();
}
class_name = PyUnicode_DecodeASCII(s, len - 1, "strict");
if (class_name != NULL) {
cls = find_class(self, module_name, class_name);
Py_DECREF(class_name);
}
}
Py_DECREF(module_name);
if (cls == NULL)
return -1;
if ((args = Pdata_poptuple(self->stack, i)) != NULL) {
obj = instantiate(cls, args);
Py_DECREF(args);
}
Py_DECREF(cls);
if (obj == NULL)
return -1;
PDATA_PUSH(self->stack, obj, -1);
return 0;
}
| 0
|
202,776
|
void RenderThread::OnSetNextPageID(int32 next_page_id) {
RenderView::SetNextPageID(next_page_id);
}
| 0
|
346,999
|
radix__arch_get_unmapped_area_topdown(struct file *filp,
const unsigned long addr0,
const unsigned long len,
const unsigned long pgoff,
const unsigned long flags)
{
struct vm_area_struct *vma;
struct mm_struct *mm = current->mm;
unsigned long addr = addr0;
struct vm_unmapped_area_info info;
if (unlikely(addr > mm->context.addr_limit &&
mm->context.addr_limit != TASK_SIZE))
mm->context.addr_limit = TASK_SIZE;
/* requested length too big for entire address space */
if (len > mm->task_size - mmap_min_addr)
return -ENOMEM;
if (flags & MAP_FIXED)
return addr;
/* requesting a specific address */
if (addr) {
addr = PAGE_ALIGN(addr);
vma = find_vma(mm, addr);
if (mm->task_size - len >= addr && addr >= mmap_min_addr &&
(!vma || addr + len <= vma->vm_start))
return addr;
}
info.flags = VM_UNMAPPED_AREA_TOPDOWN;
info.length = len;
info.low_limit = max(PAGE_SIZE, mmap_min_addr);
info.high_limit = mm->mmap_base;
info.align_mask = 0;
if (addr > DEFAULT_MAP_WINDOW)
info.high_limit += mm->context.addr_limit - DEFAULT_MAP_WINDOW;
addr = vm_unmapped_area(&info);
if (!(addr & ~PAGE_MASK))
return addr;
VM_BUG_ON(addr != -ENOMEM);
/*
* A failed mmap() very likely causes application failure,
* so fall back to the bottom-up function here. This scenario
* can happen with large stack limits and large mmap()
* allocations.
*/
return radix__arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
}
| 1
|
66,251
|
static int pvc_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
if (net != &init_net)
return -EAFNOSUPPORT;
sock->ops = &pvc_proto_ops;
return vcc_create(net, sock, protocol, PF_ATMPVC);
}
| 0
|
254,294
|
EXPORTED int mboxlist_alluser(user_cb *proc, void *rock)
{
struct alluser_rock urock;
int r = 0;
urock.prev = NULL;
urock.proc = proc;
urock.rock = rock;
r = mboxlist_allmbox(NULL, alluser_cb, &urock, /*flags*/0);
free(urock.prev);
return r;
}
| 0
|
308,802
|
int VideoRendererBase::NumFrames_Locked() const {
lock_.AssertAcquired();
int outstanding_frames =
(current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) +
(current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0);
return ready_frames_.size() + outstanding_frames;
}
| 0
|
200,626
|
void PeopleHandler::OnAccountUpdated(const AccountInfo& info) {
FireWebUIListener("stored-accounts-updated", *GetStoredAccountsList());
}
| 0
|
129,390
|
static QString currentUser(void)
{
struct passwd *current = getpwuid(getuid());
QString fullname(current->pw_gecos);
if (fullname.find(',') != -1)
/* Remove everything from and including first comma */
fullname.resize(fullname.find(','));
QString username(current->pw_name);
return fullname + " (" + username + ")";
}
| 0
|
338,302
|
static int do_sendv_recvv(int sockfd, struct iovec *iov, int len, int offset,
int do_sendv)
{
int ret, diff, iovlen;
struct iovec *last_iov;
/* last_iov is inclusive, so count from one. */
iovlen = 1;
last_iov = iov;
len += offset;
while (last_iov->iov_len < len) {
len -= last_iov->iov_len;
last_iov++;
iovlen++;
}
diff = last_iov->iov_len - len;
last_iov->iov_len -= diff;
while (iov->iov_len <= offset) {
offset -= iov->iov_len;
iov++;
iovlen--;
}
iov->iov_base = (char *) iov->iov_base + offset;
iov->iov_len -= offset;
{
#if defined CONFIG_IOVEC && defined CONFIG_POSIX
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = iov;
msg.msg_iovlen = iovlen;
do {
if (do_sendv) {
ret = sendmsg(sockfd, &msg, 0);
} else {
ret = recvmsg(sockfd, &msg, 0);
}
} while (ret == -1 && errno == EINTR);
#else
struct iovec *p = iov;
ret = 0;
while (iovlen > 0) {
int rc;
if (do_sendv) {
rc = send(sockfd, p->iov_base, p->iov_len, 0);
} else {
rc = qemu_recv(sockfd, p->iov_base, p->iov_len, 0);
}
if (rc == -1) {
if (errno == EINTR) {
continue;
}
if (ret == 0) {
ret = -1;
}
break;
}
if (rc == 0) {
break;
}
ret += rc;
iovlen--, p++;
}
#endif
}
/* Undo the changes above */
iov->iov_base = (char *) iov->iov_base - offset;
iov->iov_len += offset;
last_iov->iov_len += diff;
return ret;
}
| 1
|
268,713
|
NOEXPORT const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,
unsigned int *len) {
if(len)
*len=s->session_id_length;
return (const unsigned char *)s->session_id;
}
| 0
|
254,218
|
void BrowserPolicyConnector::RegisterForUserPolicy(
const std::string& oauth_token) {
if (user_data_store_.get())
user_data_store_->SetOAuthToken(oauth_token);
}
| 0
|
84,842
|
bool Dispatcher::operator==( const Dispatcher &x ) const
{
return ( params == x.params ) && ( parsed_params == x.parsed_params ) && ( parsed == x.parsed )
&& ( dispatch_chars == x.dispatch_chars ) && ( OSC_string == x.OSC_string ) && ( terminal_to_host == x.terminal_to_host );
}
| 0
|
360,095
|
nautilus_file_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GObject *object;
NautilusFile *file;
object = (* G_OBJECT_CLASS (nautilus_file_parent_class)->constructor) (type,
n_construct_properties,
construct_params);
file = NAUTILUS_FILE (object);
/* Set to default type after full construction */
if (NAUTILUS_FILE_GET_CLASS (file)->default_file_type != G_FILE_TYPE_UNKNOWN) {
file->details->type = NAUTILUS_FILE_GET_CLASS (file)->default_file_type;
}
return object;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.