idx
int64 | func
string | target
int64 |
|---|---|---|
33,773
|
void ndpUpdateDefaultRouterList(NetInterface *interface)
{
uint_t i;
bool_t flag;
systime_t time;
Ipv6RouterEntry *entry;
//This flag will be set if any entry has been removed from
//the Default Router List
flag = FALSE;
//Get current time
time = osGetSystemTime();
//Go through the Default Router List
for(i = 0; i < IPV6_ROUTER_LIST_SIZE; i++)
{
//Point to the current entry
entry = &interface->ipv6Context.routerList[i];
//Check the lifetime value
if(entry->lifetime > 0 && entry->lifetime < INFINITE_DELAY)
{
//A node should retain entries in the Default Router List until
//their lifetimes expire
if(timeCompare(time, entry->timestamp + entry->lifetime) >= 0)
{
//Immediately time-out the entry
entry->addr = IPV6_UNSPECIFIED_ADDR;
entry->lifetime = 0;
//Set flag
flag = TRUE;
}
}
}
//Check whether an entry has been removed from the list
if(flag)
{
//When removing an entry from the Default Router List, any entries
//in the Destination Cache that go through that router must perform
//next-hop determination again to select a new default router
ndpFlushDestCache(interface);
}
}
| 0
|
112,979
|
int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
struct page **pages)
{
struct mm_struct *mm = current->mm;
unsigned long addr, len, end;
unsigned long next, flags;
pgd_t *pgdp;
int nr = 0;
start &= PAGE_MASK;
addr = start;
len = (unsigned long) nr_pages << PAGE_SHIFT;
end = start + len;
if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
start, len)))
return 0;
/*
* Disable interrupts. We use the nested form as we can already have
* interrupts disabled by get_futex_key.
*
* With interrupts disabled, we block page table pages from being
* freed from under us. See mmu_gather_tlb in asm-generic/tlb.h
* for more details.
*
* We do not adopt an rcu_read_lock(.) here as we also want to
* block IPIs that come from THPs splitting.
*/
local_irq_save(flags);
pgdp = pgd_offset(mm, addr);
do {
pgd_t pgd = READ_ONCE(*pgdp);
next = pgd_addr_end(addr, end);
if (pgd_none(pgd))
break;
if (unlikely(pgd_huge(pgd))) {
if (!gup_huge_pgd(pgd, pgdp, addr, next, write,
pages, &nr))
break;
} else if (unlikely(is_hugepd(__hugepd(pgd_val(pgd))))) {
if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
PGDIR_SHIFT, next, write, pages, &nr))
break;
} else if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
break;
} while (pgdp++, addr = next, addr != end);
local_irq_restore(flags);
return nr;
}
| 0
|
431,995
|
void tcp_wfree(struct sk_buff *skb)
{
struct sock *sk = skb->sk;
struct tcp_sock *tp = tcp_sk(sk);
unsigned long flags, nval, oval;
/* Keep one reference on sk_wmem_alloc.
* Will be released by sk_free() from here or tcp_tasklet_func()
*/
WARN_ON(refcount_sub_and_test(skb->truesize - 1, &sk->sk_wmem_alloc));
/* If this softirq is serviced by ksoftirqd, we are likely under stress.
* Wait until our queues (qdisc + devices) are drained.
* This gives :
* - less callbacks to tcp_write_xmit(), reducing stress (batches)
* - chance for incoming ACK (processed by another cpu maybe)
* to migrate this flow (skb->ooo_okay will be eventually set)
*/
if (refcount_read(&sk->sk_wmem_alloc) >= SKB_TRUESIZE(1) && this_cpu_ksoftirqd() == current)
goto out;
for (oval = READ_ONCE(sk->sk_tsq_flags);; oval = nval) {
struct tsq_tasklet *tsq;
bool empty;
if (!(oval & TSQF_THROTTLED) || (oval & TSQF_QUEUED))
goto out;
nval = (oval & ~TSQF_THROTTLED) | TSQF_QUEUED | TCPF_TSQ_DEFERRED;
nval = cmpxchg(&sk->sk_tsq_flags, oval, nval);
if (nval != oval)
continue;
/* queue this socket to tasklet queue */
local_irq_save(flags);
tsq = this_cpu_ptr(&tsq_tasklet);
empty = list_empty(&tsq->head);
list_add(&tp->tsq_node, &tsq->head);
if (empty)
tasklet_schedule(&tsq->tasklet);
local_irq_restore(flags);
return;
}
out:
sk_free(sk);
}
| 0
|
501,815
|
get_other_operator(List *otherOp, Oid otherLeftTypeId, Oid otherRightTypeId,
const char *operatorName, Oid operatorNamespace,
Oid leftTypeId, Oid rightTypeId, bool isCommutator)
{
Oid other_oid;
bool otherDefined;
char *otherName;
Oid otherNamespace;
AclResult aclresult;
other_oid = OperatorLookup(otherOp,
otherLeftTypeId,
otherRightTypeId,
&otherDefined);
if (OidIsValid(other_oid))
{
/* other op already in catalogs */
return other_oid;
}
otherNamespace = QualifiedNameGetCreationNamespace(otherOp,
&otherName);
if (strcmp(otherName, operatorName) == 0 &&
otherNamespace == operatorNamespace &&
otherLeftTypeId == leftTypeId &&
otherRightTypeId == rightTypeId)
{
/*
* self-linkage to this operator; caller will fix later. Note that
* only self-linkage for commutation makes sense.
*/
if (!isCommutator)
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("operator cannot be its own negator or sort operator")));
return InvalidOid;
}
/* not in catalogs, different from operator, so make shell */
aclresult = pg_namespace_aclcheck(otherNamespace, GetUserId(),
ACL_CREATE);
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
get_namespace_name(otherNamespace));
other_oid = OperatorShellMake(otherName,
otherNamespace,
otherLeftTypeId,
otherRightTypeId);
return other_oid;
}
| 0
|
144,216
|
std::string Box_clap::dump(Indent& indent) const
{
std::ostringstream sstr;
sstr << Box::dump(indent);
sstr << indent << "clean_aperture: " << m_clean_aperture_width.numerator
<< "/" << m_clean_aperture_width.denominator << " x "
<< m_clean_aperture_height.numerator << "/"
<< m_clean_aperture_height.denominator << "\n";
sstr << indent << "offset: " << m_horizontal_offset.numerator << "/"
<< m_horizontal_offset.denominator << " ; "
<< m_vertical_offset.numerator << "/"
<< m_vertical_offset.denominator << "\n";
return sstr.str();
}
| 0
|
431,990
|
static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
struct tcp_out_options *opts,
struct tcp_md5sig_key **md5)
{
struct tcp_sock *tp = tcp_sk(sk);
unsigned int remaining = MAX_TCP_OPTION_SPACE;
struct tcp_fastopen_request *fastopen = tp->fastopen_req;
#ifdef CONFIG_TCP_MD5SIG
*md5 = tp->af_specific->md5_lookup(sk, sk);
if (*md5) {
opts->options |= OPTION_MD5;
remaining -= TCPOLEN_MD5SIG_ALIGNED;
}
#else
*md5 = NULL;
#endif
/* We always get an MSS option. The option bytes which will be seen in
* normal data packets should timestamps be used, must be in the MSS
* advertised. But we subtract them from tp->mss_cache so that
* calculations in tcp_sendmsg are simpler etc. So account for this
* fact here if necessary. If we don't do this correctly, as a
* receiver we won't recognize data packets as being full sized when we
* should, and thus we won't abide by the delayed ACK rules correctly.
* SACKs don't matter, we never delay an ACK when we have any of those
* going out. */
opts->mss = tcp_advertise_mss(sk);
remaining -= TCPOLEN_MSS_ALIGNED;
if (likely(sock_net(sk)->ipv4.sysctl_tcp_timestamps && !*md5)) {
opts->options |= OPTION_TS;
opts->tsval = tcp_skb_timestamp(skb) + tp->tsoffset;
opts->tsecr = tp->rx_opt.ts_recent;
remaining -= TCPOLEN_TSTAMP_ALIGNED;
}
if (likely(sock_net(sk)->ipv4.sysctl_tcp_window_scaling)) {
opts->ws = tp->rx_opt.rcv_wscale;
opts->options |= OPTION_WSCALE;
remaining -= TCPOLEN_WSCALE_ALIGNED;
}
if (likely(sock_net(sk)->ipv4.sysctl_tcp_sack)) {
opts->options |= OPTION_SACK_ADVERTISE;
if (unlikely(!(OPTION_TS & opts->options)))
remaining -= TCPOLEN_SACKPERM_ALIGNED;
}
if (fastopen && fastopen->cookie.len >= 0) {
u32 need = fastopen->cookie.len;
need += fastopen->cookie.exp ? TCPOLEN_EXP_FASTOPEN_BASE :
TCPOLEN_FASTOPEN_BASE;
need = (need + 3) & ~3U; /* Align to 32 bits */
if (remaining >= need) {
opts->options |= OPTION_FAST_OPEN_COOKIE;
opts->fastopen_cookie = &fastopen->cookie;
remaining -= need;
tp->syn_fastopen = 1;
tp->syn_fastopen_exp = fastopen->cookie.exp ? 1 : 0;
}
}
smc_set_option(tp, opts, &remaining);
return MAX_TCP_OPTION_SPACE - remaining;
}
| 0
|
480,220
|
static int rotateLogSet(const struct logInfo *log, int force)
{
unsigned i, j;
int hasErrors = 0;
int *logHasErrors;
int numRotated = 0;
struct logState **state;
struct logNames **rotNames;
message(MESS_DEBUG, "\nrotating pattern: %s ", log->pattern);
if (force) {
message(MESS_DEBUG, "forced from command line ");
}
else {
switch (log->criterium) {
case ROT_HOURLY:
message(MESS_DEBUG, "hourly ");
break;
case ROT_DAYS:
message(MESS_DEBUG, "after %jd days ", (intmax_t)log->threshold);
break;
case ROT_WEEKLY:
message(MESS_DEBUG, "weekly ");
break;
case ROT_MONTHLY:
message(MESS_DEBUG, "monthly ");
break;
case ROT_YEARLY:
message(MESS_DEBUG, "yearly ");
break;
case ROT_SIZE:
message(MESS_DEBUG, "%jd bytes ", (intmax_t)log->threshold);
break;
default:
message(MESS_FATAL, "rotateLogSet() does not have case for: %u ",
(unsigned) log->criterium);
}
}
if (log->rotateCount > 0)
message(MESS_DEBUG, "(%d rotations)\n", log->rotateCount);
else if (log->rotateCount == 0)
message(MESS_DEBUG, "(no old logs will be kept)\n");
if (log->oldDir)
message(MESS_DEBUG, "olddir is %s, ", log->oldDir);
if (log->flags & LOG_FLAG_IFEMPTY)
message(MESS_DEBUG, "empty log files are rotated, ");
else
message(MESS_DEBUG, "empty log files are not rotated, ");
if (log->minsize)
message(MESS_DEBUG, "only log files >= %jd bytes are rotated, ", (intmax_t)log->minsize);
if (log->maxsize)
message(MESS_DEBUG, "log files >= %jd are rotated earlier, ", (intmax_t)log->maxsize);
if (log->rotateMinAge)
message(MESS_DEBUG, "only log files older than %d days are rotated, ", log->rotateMinAge);
if (log->logAddress) {
message(MESS_DEBUG, "old logs mailed to %s\n", log->logAddress);
} else {
message(MESS_DEBUG, "old logs are removed\n");
}
if (log->numFiles == 0) {
message(MESS_DEBUG, "No logs found. Rotation not needed.\n");
return 0;
}
logHasErrors = calloc(log->numFiles, sizeof(int));
if (!logHasErrors) {
message_OOM();
return 1;
}
if (log->flags & LOG_FLAG_SU) {
if (switch_user(log->suUid, log->suGid) != 0) {
free(logHasErrors);
return 1;
}
}
for (i = 0; i < log->numFiles; i++) {
struct logState *logState;
logHasErrors[i] = findNeedRotating(log, i, force);
hasErrors |= logHasErrors[i];
/* sure is a lot of findStating going on .. */
if (((logState = findState(log->files[i]))) && logState->doRotate)
numRotated++;
}
if (log->first) {
if (!numRotated) {
message(MESS_DEBUG, "not running first action script, "
"since no logs will be rotated\n");
} else {
message(MESS_DEBUG, "running first action script\n");
if (runScript(log, log->pattern, NULL, log->first)) {
message(MESS_ERROR, "error running first action script "
"for %s\n", log->pattern);
hasErrors = 1;
if (log->flags & LOG_FLAG_SU) {
if (switch_user_back() != 0) {
free(logHasErrors);
return 1;
}
}
/* finish early, firstaction failed, affects all logs in set */
free(logHasErrors);
return hasErrors;
}
}
}
state = malloc(log->numFiles * sizeof(struct logState *));
rotNames = malloc(log->numFiles * sizeof(struct logNames *));
if (state == NULL || rotNames == NULL) {
message_OOM();
if (log->flags & LOG_FLAG_SU) {
switch_user_back();
}
free(rotNames);
free(state);
free(logHasErrors);
return 1;
}
for (j = 0;
(!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && j < log->numFiles)
|| ((log->flags & LOG_FLAG_SHAREDSCRIPTS) && j < 1); j++) {
for (i = j;
((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
|| (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
state[i] = findState(log->files[i]);
if (!state[i])
logHasErrors[i] = 1;
rotNames[i] = malloc(sizeof(struct logNames));
if (rotNames[i] == NULL) {
message_OOM();
if (log->flags & LOG_FLAG_SU) {
switch_user_back();
}
free(rotNames);
free(state);
free(logHasErrors);
return 1;
}
memset(rotNames[i], 0, sizeof(struct logNames));
logHasErrors[i] |=
prerotateSingleLog(log, i, state[i], rotNames[i]);
hasErrors |= logHasErrors[i];
}
if (log->pre
&& (!(
(!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && (logHasErrors[j] || !state[j]->doRotate))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS))
))
) {
if (!numRotated) {
message(MESS_DEBUG, "not running prerotate script, "
"since no logs will be rotated\n");
} else {
message(MESS_DEBUG, "running prerotate script\n");
if (runScript(log, (log->flags & LOG_FLAG_SHAREDSCRIPTS) ? log->pattern : log->files[j], NULL, log->pre)) {
if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
message(MESS_ERROR,
"error running shared prerotate script "
"for '%s'\n", log->pattern);
else {
message(MESS_ERROR,
"error running non-shared prerotate script "
"for %s of '%s'\n", log->files[j], log->pattern);
}
logHasErrors[j] = 1;
hasErrors = 1;
}
}
}
for (i = j;
((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
|| (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
if (! ( (logHasErrors[i] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) {
logHasErrors[i] |=
rotateSingleLog(log, i, state[i], rotNames[i]);
hasErrors |= logHasErrors[i];
}
}
if (log->post
&& (!(
(!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && (logHasErrors[j] || !state[j]->doRotate))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS))
))
) {
if (!numRotated) {
message(MESS_DEBUG, "not running postrotate script, "
"since no logs were rotated\n");
} else {
char *logfn = (log->flags & LOG_FLAG_SHAREDSCRIPTS) ? log->pattern : log->files[j];
/* It only makes sense to pass in a final rotated filename if scripts are not shared */
char *logrotfn = (log->flags & LOG_FLAG_SHAREDSCRIPTS) ? NULL : rotNames[j]->finalName;
message(MESS_DEBUG, "running postrotate script\n");
if (runScript(log, logfn, logrotfn, log->post)) {
if (log->flags & LOG_FLAG_SHAREDSCRIPTS)
message(MESS_ERROR,
"error running shared postrotate script "
"for '%s'\n", log->pattern);
else {
message(MESS_ERROR,
"error running non-shared postrotate script "
"for %s of '%s'\n", log->files[j], log->pattern);
}
logHasErrors[j] = 1;
hasErrors = 1;
}
}
}
for (i = j;
((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
|| (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
if (! ( (logHasErrors[i] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
|| (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) ) {
logHasErrors[i] |=
postrotateSingleLog(log, i, state[i], rotNames[i]);
hasErrors |= logHasErrors[i];
}
}
}
for (i = 0; i < log->numFiles; i++) {
free(rotNames[i]->firstRotated);
free(rotNames[i]->disposeName);
free(rotNames[i]->finalName);
free(rotNames[i]->dirName);
free(rotNames[i]->baseName);
free(rotNames[i]);
}
free(rotNames);
free(state);
if (log->last) {
if (!numRotated) {
message(MESS_DEBUG, "not running last action script, "
"since no logs will be rotated\n");
} else {
message(MESS_DEBUG, "running last action script\n");
if (runScript(log, log->pattern, NULL, log->last)) {
message(MESS_ERROR, "error running last action script "
"for %s\n", log->pattern);
hasErrors = 1;
}
}
}
if (log->flags & LOG_FLAG_SU) {
if (switch_user_back() != 0) {
free(logHasErrors);
return 1;
}
}
free(logHasErrors);
return hasErrors;
}
| 0
|
355,073
|
SProcShmQueryVersion(client)
register ClientPtr client;
{
register int n;
REQUEST(xShmQueryVersionReq);
swaps(&stuff->length, n);
return ProcShmQueryVersion(client);
}
| 0
|
499,939
|
QPDFFormFieldObjectHelper::getDefaultAppearance()
{
return getInheritableFieldValueAsString("/DA");
}
| 0
|
6,419
|
isakmp_rfc3948_print(netdissect_options *ndo,
const u_char *bp, u_int length,
const u_char *bp2)
{
if(length == 1 && bp[0]==0xff) {
ND_PRINT((ndo, "isakmp-nat-keep-alive"));
return;
}
if(length < 4) {
goto trunc;
}
/*
* see if this is an IKE packet
*/
if(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) {
ND_PRINT((ndo, "NONESP-encap: "));
isakmp_print(ndo, bp+4, length-4, bp2);
return;
}
/* must be an ESP packet */
{
int nh, enh, padlen;
int advance;
ND_PRINT((ndo, "UDP-encap: "));
advance = esp_print(ndo, bp, length, bp2, &enh, &padlen);
if(advance <= 0)
return;
bp += advance;
length -= advance + padlen;
nh = enh & 0xff;
ip_print_inner(ndo, bp, length, nh, bp2);
return;
}
trunc:
ND_PRINT((ndo,"[|isakmp]"));
return;
}
| 1
|
51,622
|
rpl_daoack_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
const struct nd_rpl_daoack *daoack = (const struct nd_rpl_daoack *)bp;
const char *dagid_str = "<elided>";
ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN);
if (length < ND_RPL_DAOACK_MIN_LEN)
goto tooshort;
bp += ND_RPL_DAOACK_MIN_LEN;
length -= ND_RPL_DAOACK_MIN_LEN;
if(RPL_DAOACK_D(daoack->rpl_flags)) {
ND_TCHECK2(daoack->rpl_dagid, DAGID_LEN);
if (length < DAGID_LEN)
goto tooshort;
dagid_str = ip6addr_string (ndo, daoack->rpl_dagid);
bp += DAGID_LEN;
length -= DAGID_LEN;
}
ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u,status:%u]",
dagid_str,
daoack->rpl_daoseq,
daoack->rpl_instanceid,
daoack->rpl_status));
/* no officially defined options for DAOACK, but print any we find */
if(ndo->ndo_vflag > 1) {
const struct rpl_dio_genoption *opt = (const struct rpl_dio_genoption *)bp;
rpl_dio_printopt(ndo, opt, length);
}
return;
trunc:
ND_PRINT((ndo," [|dao-truncated]"));
return;
tooshort:
ND_PRINT((ndo," [|dao-length too short]"));
return;
}
| 0
|
346,727
|
static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
{
}
| 1
|
227,838
|
void RootWindowHostWin::ShowCursor(bool show) {
}
| 0
|
67,591
|
static int build_sched_domains(const struct cpumask *cpu_map)
{
return __build_sched_domains(cpu_map, NULL);
}
| 0
|
45,020
|
f_sha256(typval_T *argvars, typval_T *rettv)
{
char_u *p;
p = tv_get_string(&argvars[0]);
rettv->vval.v_string = vim_strsave(
sha256_bytes(p, (int)STRLEN(p), NULL, 0));
rettv->v_type = VAR_STRING;
}
| 0
|
144,891
|
kex_alg_list(char sep)
{
char *ret = NULL, *tmp;
size_t nlen, rlen = 0;
const struct kexalg *k;
for (k = kexalgs; k->name != NULL; k++) {
if (ret != NULL)
ret[rlen++] = sep;
nlen = strlen(k->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == NULL) {
free(ret);
return NULL;
}
ret = tmp;
memcpy(ret + rlen, k->name, nlen + 1);
rlen += nlen;
}
return ret;
}
| 0
|
331,728
|
static void test_visitor_out_bool(TestOutputVisitorData *data,
const void *unused)
{
bool value = true;
QObject *obj;
visit_type_bool(data->ov, NULL, &value, &error_abort);
obj = visitor_get(data);
g_assert(qobject_type(obj) == QTYPE_QBOOL);
g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value);
}
| 0
|
228,097
|
void SelectionController::SetCaretAtHitTestResult(
const HitTestResult& hit_test_result) {
Node* inner_node = hit_test_result.InnerNode();
const VisiblePositionInFlatTree& visible_hit_pos =
VisiblePositionOfHitTestResult(hit_test_result);
const VisiblePositionInFlatTree& visible_pos =
visible_hit_pos.IsNull()
? CreateVisiblePosition(
PositionInFlatTree::FirstPositionInOrBeforeNode(inner_node))
: visible_hit_pos;
if (visible_pos.IsNull()) {
UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node, SelectionInFlatTree(), TextGranularity::kCharacter,
HandleVisibility::kVisible);
return;
}
UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node,
ExpandSelectionToRespectUserSelectAll(
inner_node, SelectionInFlatTree::Builder()
.Collapse(visible_pos.ToPositionWithAffinity())
.Build()),
TextGranularity::kCharacter, HandleVisibility::kVisible);
}
| 0
|
405,584
|
WandExport void DrawPathMoveToAbsolute(DrawingWand *wand,const double x,
const double y)
{
assert(wand != (DrawingWand *) NULL);
assert(wand->signature == MagickWandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
DrawPathMoveTo(wand,AbsolutePathMode,x,y);
}
| 0
|
286,201
|
hfs_istat(TSK_FS_INFO * fs, TSK_FS_ISTAT_FLAG_ENUM istat_flags, FILE * hFile, TSK_INUM_T inum,
TSK_DADDR_T numblock, int32_t sec_skew)
{
HFS_INFO *hfs = (HFS_INFO *) fs;
TSK_FS_FILE *fs_file;
char hfs_mode[12];
HFS_PRINT_ADDR print;
HFS_ENTRY entry;
char timeBuf[128];
const TSK_FS_ATTR *compressionAttr = NULL;
RES_DESCRIPTOR *rd; // descriptor of a resource
tsk_error_reset();
if (tsk_verbose)
tsk_fprintf(stderr,
"hfs_istat: inum: %" PRIuINUM " numblock: %" PRIu32 "\n",
inum, numblock);
if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {
error_returned("hfs_istat: getting metadata for the file");
return 1;
}
if (inum >= HFS_FIRST_USER_CNID) {
int rslt;
tsk_fprintf(hFile, "File Path: ");
rslt = print_parent_path(hFile, fs, inum);
if (rslt != 0)
tsk_fprintf(hFile, " Error in printing path\n");
else
tsk_fprintf(hFile, "\n");
}
else {
if (fs_file->meta->name2 != NULL)
tsk_fprintf(hFile, "File Name: %s\n",
fs_file->meta->name2->name);
}
tsk_fprintf(hFile, "Catalog Record: %" PRIuINUM "\n", inum);
tsk_fprintf(hFile, "%sAllocated\n",
(fs_file->meta->flags & TSK_FS_META_FLAG_UNALLOC) ? "Not " : "");
tsk_fprintf(hFile, "Type:\t");
if (fs_file->meta->type == TSK_FS_META_TYPE_REG)
tsk_fprintf(hFile, "File\n");
else if (TSK_FS_IS_DIR_META(fs_file->meta->type))
tsk_fprintf(hFile, "Folder\n");
else
tsk_fprintf(hFile, "\n");
tsk_fs_meta_make_ls(fs_file->meta, hfs_mode, sizeof(hfs_mode));
tsk_fprintf(hFile, "Mode:\t%s\n", hfs_mode);
tsk_fprintf(hFile, "Size:\t%" PRIuOFF "\n", fs_file->meta->size);
if (fs_file->meta->link)
tsk_fprintf(hFile, "Symbolic link to:\t%s\n", fs_file->meta->link);
tsk_fprintf(hFile, "uid / gid: %" PRIuUID " / %" PRIuGID "\n",
fs_file->meta->uid, fs_file->meta->gid);
tsk_fprintf(hFile, "Link count:\t%d\n", fs_file->meta->nlink);
if (hfs_cat_file_lookup(hfs, inum, &entry, TRUE) == 0) {
hfs_uni_str *nm = &entry.thread.name;
char name_buf[HFS_MAXNAMLEN + 1];
TSK_INUM_T par_cnid; // parent CNID
tsk_fprintf(hFile, "\n");
hfs_UTF16toUTF8(fs, nm->unicode, (int) tsk_getu16(fs->endian,
nm->length), &name_buf[0], HFS_MAXNAMLEN + 1,
HFS_U16U8_FLAG_REPLACE_SLASH | HFS_U16U8_FLAG_REPLACE_CONTROL);
tsk_fprintf(hFile, "File Name: %s\n", name_buf);
par_cnid = tsk_getu32(fs->endian, &(entry.thread.parent_cnid));
if ((hfs->has_meta_dir_crtime && par_cnid == hfs->meta_dir_inum) ||
(hfs->has_meta_crtime && par_cnid == hfs->meta_inum)) {
int instr = strncmp(name_buf, "iNode", 5);
int drstr = strncmp(name_buf, "dir_", 4);
if (instr == 0 &&
hfs->has_meta_crtime && par_cnid == hfs->meta_inum) {
tsk_fprintf(hFile, "This is a hard link to a file\n");
}
else if (drstr == 0 &&
hfs->has_meta_dir_crtime &&
par_cnid == hfs->meta_dir_inum) {
tsk_fprintf(hFile, "This is a hard link to a folder.\n");
}
}
/* The cat.perm union contains file-type specific values.
* Print them if they are relevant. */
if ((fs_file->meta->type == TSK_FS_META_TYPE_CHR) ||
(fs_file->meta->type == TSK_FS_META_TYPE_BLK)) {
tsk_fprintf(hFile, "Device ID:\t%" PRIu32 "\n",
tsk_getu32(fs->endian, entry.cat.std.perm.special.raw));
}
else if ((tsk_getu32(fs->endian,
entry.cat.std.u_info.file_type) ==
HFS_HARDLINK_FILE_TYPE)
&& (tsk_getu32(fs->endian,
entry.cat.std.u_info.file_cr) ==
HFS_HARDLINK_FILE_CREATOR)) {
tsk_fprintf(hFile, "Hard link inode number\t %" PRIu32 "\n",
tsk_getu32(fs->endian, entry.cat.std.perm.special.inum));
}
tsk_fprintf(hFile, "Admin flags: %" PRIu8,
entry.cat.std.perm.a_flags);
if (entry.cat.std.perm.a_flags != 0) {
tsk_fprintf(hFile, " - ");
if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_ARCHIVED)
tsk_fprintf(hFile, "archived ");
if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_IMMUTABLE)
tsk_fprintf(hFile, "immutable ");
if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_APPEND)
tsk_fprintf(hFile, "append-only ");
}
tsk_fprintf(hFile, "\n");
tsk_fprintf(hFile, "Owner flags: %" PRIu8,
entry.cat.std.perm.o_flags);
if (entry.cat.std.perm.o_flags != 0) {
tsk_fprintf(hFile, " - ");
if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_NODUMP)
tsk_fprintf(hFile, "no-dump ");
if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_IMMUTABLE)
tsk_fprintf(hFile, "immutable ");
if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_APPEND)
tsk_fprintf(hFile, "append-only ");
if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_OPAQUE)
tsk_fprintf(hFile, "opaque ");
if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED)
tsk_fprintf(hFile, "compressed ");
}
tsk_fprintf(hFile, "\n");
if (tsk_getu16(fs->endian,
entry.cat.std.flags) & HFS_FILE_FLAG_LOCKED)
tsk_fprintf(hFile, "Locked\n");
if (tsk_getu16(fs->endian,
entry.cat.std.flags) & HFS_FILE_FLAG_ATTR)
tsk_fprintf(hFile, "Has extended attributes\n");
if (tsk_getu16(fs->endian,
entry.cat.std.flags) & HFS_FILE_FLAG_ACL)
tsk_fprintf(hFile, "Has security data (ACLs)\n");
if ( !TSK_FS_IS_DIR_META(fs_file->meta->type)){
int windx; // loop index
tsk_fprintf(hFile,
"File type:\t%04" PRIx32 " ",
tsk_getu32(fs->endian, entry.cat.std.u_info.file_type));
for (windx = 0; windx < 4; ++windx) {
uint8_t cu = entry.cat.std.u_info.file_type[windx];
if (cu >= 32 && cu <= 126)
tsk_fprintf(hFile, "%c", (char) cu);
else
tsk_fprintf(hFile, " ");
}
tsk_fprintf(hFile, "\n");
tsk_fprintf(hFile,
"File creator:\t%04" PRIx32 " ",
tsk_getu32(fs->endian, entry.cat.std.u_info.file_cr));
for (windx = 0; windx < 4; ++windx) {
uint8_t cu = entry.cat.std.u_info.file_cr[windx];
if (cu >= 32 && cu <= 126)
tsk_fprintf(hFile, "%c", (char) cu);
else
tsk_fprintf(hFile, " ");
}
tsk_fprintf(hFile, "\n");
} // END if(not folder)
if (tsk_getu16(fs->endian,
entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_NAME_LOCKED)
tsk_fprintf(hFile, "Name locked\n");
if (tsk_getu16(fs->endian,
entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_HAS_BUNDLE)
tsk_fprintf(hFile, "Has bundle\n");
if (tsk_getu16(fs->endian,
entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_IS_INVISIBLE)
tsk_fprintf(hFile, "Is invisible\n");
if (tsk_getu16(fs->endian,
entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_IS_ALIAS)
tsk_fprintf(hFile, "Is alias\n");
tsk_fprintf(hFile, "Text encoding:\t%" PRIx32 " = %s\n",
tsk_getu32(fs->endian, entry.cat.std.text_enc),
text_encoding_name(tsk_getu32(fs->endian,
entry.cat.std.text_enc)));
if (tsk_getu16(fs->endian,
entry.cat.std.rec_type) == HFS_FILE_RECORD) {
tsk_fprintf(hFile, "Resource fork size:\t%" PRIu64 "\n",
tsk_getu64(fs->endian, entry.cat.resource.logic_sz));
}
}
if (sec_skew != 0) {
tsk_fprintf(hFile, "\nAdjusted times:\n");
if (fs_file->meta->mtime)
fs_file->meta->mtime -= sec_skew;
if (fs_file->meta->atime)
fs_file->meta->atime -= sec_skew;
if (fs_file->meta->ctime)
fs_file->meta->ctime -= sec_skew;
if (fs_file->meta->crtime)
fs_file->meta->crtime -= sec_skew;
if (fs_file->meta->time2.hfs.bkup_time)
fs_file->meta->time2.hfs.bkup_time -= sec_skew;
tsk_fprintf(hFile, "Created:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->crtime, timeBuf));
tsk_fprintf(hFile, "Content Modified:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->mtime, timeBuf));
tsk_fprintf(hFile, "Attributes Modified:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->ctime, timeBuf));
tsk_fprintf(hFile, "Accessed:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->atime, timeBuf));
tsk_fprintf(hFile, "Backed Up:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->time2.hfs.bkup_time,
timeBuf));
if (fs_file->meta->mtime)
fs_file->meta->mtime += sec_skew;
if (fs_file->meta->atime)
fs_file->meta->atime += sec_skew;
if (fs_file->meta->ctime)
fs_file->meta->ctime += sec_skew;
if (fs_file->meta->crtime)
fs_file->meta->crtime += sec_skew;
if (fs_file->meta->time2.hfs.bkup_time)
fs_file->meta->time2.hfs.bkup_time += sec_skew;
tsk_fprintf(hFile, "\nOriginal times:\n");
}
else {
tsk_fprintf(hFile, "\nTimes:\n");
}
tsk_fprintf(hFile, "Created:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->crtime, timeBuf));
tsk_fprintf(hFile, "Content Modified:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->mtime, timeBuf));
tsk_fprintf(hFile, "Attributes Modified:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->ctime, timeBuf));
tsk_fprintf(hFile, "Accessed:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->atime, timeBuf));
tsk_fprintf(hFile, "Backed Up:\t%s\n",
tsk_fs_time_to_str(fs_file->meta->time2.hfs.bkup_time, timeBuf));
if (tsk_getu16(fs->endian, entry.cat.std.rec_type) == HFS_FILE_RECORD) {
if (!(entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED)) {
if (!(istat_flags & TSK_FS_ISTAT_RUNLIST)) {
tsk_fprintf(hFile, "\nData Fork Blocks:\n");
print.idx = 0;
print.hFile = hFile;
print.accumulating = FALSE;
print.startBlock = 0;
print.blockCount = 0;
if (tsk_fs_file_walk_type(fs_file,
TSK_FS_ATTR_TYPE_HFS_DATA, HFS_FS_ATTR_ID_DATA,
(TSK_FS_FILE_WALK_FLAG_AONLY |
TSK_FS_FILE_WALK_FLAG_SLACK), print_addr_act,
(void *)&print)) {
tsk_fprintf(hFile, "\nError reading file data fork\n");
tsk_error_print(hFile);
tsk_error_reset();
}
else {
output_print_addr(&print);
if (print.idx != 0)
tsk_fprintf(hFile, "\n");
}
}
}
if (tsk_getu64(fs->endian, entry.cat.resource.logic_sz) > 0) {
if (! (istat_flags & TSK_FS_ISTAT_RUNLIST)) {
tsk_fprintf(hFile, "\nResource Fork Blocks:\n");
print.idx = 0;
print.hFile = hFile;
print.accumulating = FALSE;
print.startBlock = 0;
print.blockCount = 0;
if (tsk_fs_file_walk_type(fs_file,
TSK_FS_ATTR_TYPE_HFS_RSRC, HFS_FS_ATTR_ID_RSRC,
(TSK_FS_FILE_WALK_FLAG_AONLY |
TSK_FS_FILE_WALK_FLAG_SLACK), print_addr_act,
(void *)&print)) {
tsk_fprintf(hFile, "\nError reading file resource fork\n");
tsk_error_print(hFile);
tsk_error_reset();
}
else {
output_print_addr(&print);
if (print.idx != 0)
tsk_fprintf(hFile, "\n");
}
}
}
}
(void) tsk_fs_file_attr_get(fs_file);
/* Print all of the attributes */
tsk_fprintf(hFile, "\nAttributes: \n");
if (fs_file->meta->attr) {
int cnt, i;
cnt = tsk_fs_file_attr_getsize(fs_file);
for (i = 0; i < cnt; ++i) {
const char *type; // type of the attribute as a string
const TSK_FS_ATTR *fs_attr =
tsk_fs_file_attr_get_idx(fs_file, i);
if (!fs_attr)
continue;
type = hfs_attrTypeName((uint32_t) fs_attr->type);
/* print the layout if it is non-resident and not "special" */
if (fs_attr->flags & TSK_FS_ATTR_NONRES) {
tsk_fprintf(hFile,
"Type: %s (%" PRIu32 "-%" PRIu16
") Name: %s Non-Resident%s%s%s size: %"
PRIuOFF " init_size: %" PRIuOFF "\n", type,
fs_attr->type, fs_attr->id,
(fs_attr->name) ? fs_attr->name : "N/A",
(fs_attr->flags & TSK_FS_ATTR_ENC) ? ", Encrypted" :
"",
(fs_attr->flags & TSK_FS_ATTR_COMP) ? ", Compressed" :
"",
(fs_attr->flags & TSK_FS_ATTR_SPARSE) ? ", Sparse" :
"", fs_attr->size, fs_attr->nrd.initsize);
if (istat_flags & TSK_FS_ISTAT_RUNLIST) {
if (tsk_fs_attr_print(fs_attr, hFile)) {
tsk_fprintf(hFile, "\nError creating run lists\n");
tsk_error_print(hFile);
tsk_error_reset();
}
}
} // END: non-resident attribute case
else {
tsk_fprintf(hFile,
"Type: %s (%" PRIu32 "-%" PRIu16
") Name: %s Resident%s%s%s size: %"
PRIuOFF "\n",
type,
fs_attr->type,
fs_attr->id,
(fs_attr->name) ? fs_attr->name : "N/A",
(fs_attr->flags & TSK_FS_ATTR_ENC) ? ", Encrypted" :
"",
(fs_attr->flags & TSK_FS_ATTR_COMP) ? ", Compressed" :
"",
(fs_attr->flags & TSK_FS_ATTR_SPARSE) ? ", Sparse" :
"", fs_attr->size);
if (fs_attr->type == TSK_FS_ATTR_TYPE_HFS_COMP_REC) {
if (compressionAttr == NULL) {
compressionAttr = fs_attr;
}
else {
error_detected(TSK_ERR_FS_CORRUPT,
"hfs_istat: more than one compression attribute");
return 1;
}
}
} // END: else (RESIDENT attribute case)
} // END: for(;;) loop over attributes
} // END: if(fs_file->meta->attr is non-NULL)
if ((entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED)
&& (compressionAttr == NULL))
tsk_fprintf(hFile,
"WARNING: Compression Flag is set, but there"
" is no compression record for this file.\n");
if (((entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED) == 0)
&& (compressionAttr != NULL))
tsk_fprintf(hFile,
"WARNING: Compression Flag is NOT set, but there"
" is a compression record for this file.\n");
if (compressionAttr != NULL) {
const TSK_FS_ATTR *fs_attr = compressionAttr;
ssize_t attrReadResult;
DECMPFS_DISK_HEADER *cmph;
uint32_t cmpType;
uint64_t uncSize;
uint64_t cmpSize = 0;
char *aBuf = (char *) tsk_malloc((size_t) fs_attr->size);
if (aBuf == NULL) {
error_returned("hfs_istat: space for a compression attribute");
return 1;
}
attrReadResult = tsk_fs_attr_read(fs_attr, (TSK_OFF_T) 0,
aBuf, (size_t) fs_attr->size,
(TSK_FS_FILE_READ_FLAG_ENUM) 0x00);
if (attrReadResult == -1) {
error_returned("hfs_istat: reading the compression attribute");
free(aBuf);
return 1;
}
else if (attrReadResult < fs_attr->size) {
error_detected(TSK_ERR_FS_READ,
"hfs_istat: could not read the whole compression attribute");
free(aBuf);
return 1;
}
cmph = (DECMPFS_DISK_HEADER *) aBuf;
cmpType = tsk_getu32(TSK_LIT_ENDIAN, cmph->compression_type);
uncSize = tsk_getu64(TSK_LIT_ENDIAN, cmph->uncompressed_size);
tsk_fprintf(hFile, "\nCompressed File:\n");
tsk_fprintf(hFile, " Uncompressed size: %llu\n", uncSize);
switch (cmpType) {
case DECMPFS_TYPE_ZLIB_ATTR:
{
uint32_t off = (cmph->attr_bytes[0] & 0x0F) == 0x0F ? 17 : 16;
cmpSize = fs_attr->size - off;
tsk_fprintf(hFile,
" Data follows compression record in the CMPF attribute\n"
" %" PRIu64 " bytes of data at offset %u, %s compressed\n",
cmpSize, off, off == 16 ? "zlib" : "not");
}
break;
case DECMPFS_TYPE_LZVN_ATTR:
{
uint32_t off = cmph->attr_bytes[0] == 0x06 ? 17 : 16;
cmpSize = fs_attr->size - off;
tsk_fprintf(hFile,
" Data follows compression record in the CMPF attribute\n"
" %" PRIu64 " bytes of data at offset %u, %s compressed\n",
cmpSize, off, off == 16 ? "lzvn" : "not");
}
break;
case DECMPFS_TYPE_ZLIB_RSRC:
tsk_fprintf(hFile,
" Data is zlib compressed in the resource fork\n");
break;
case DECMPFS_TYPE_LZVN_RSRC:
tsk_fprintf(hFile,
" Data is lzvn compressed in the resource fork\n");
break;
default:
tsk_fprintf(hFile, " Compression type is %u: UNKNOWN\n",
cmpType);
}
free(aBuf);
if ((cmpType == DECMPFS_TYPE_ZLIB_RSRC ||
cmpType == DECMPFS_TYPE_LZVN_RSRC)
&& (tsk_getu64(fs->endian, entry.cat.resource.logic_sz) == 0))
tsk_fprintf(hFile,
"WARNING: Compression record indicates compressed data"
" in the RSRC Fork, but that fork is empty.\n");
}
rd = hfs_parse_resource_fork(fs_file);
if (rd != NULL) {
tsk_fprintf(hFile, "\nResources:\n");
while (rd) {
tsk_fprintf(hFile,
" Type: %s \tID: %-5u \tOffset: %-5u \tSize: %-5u \tName: %s\n",
rd->type, rd->id, rd->offset, rd->length, rd->name);
rd = rd->next;
}
}
free_res_descriptor(rd);
tsk_fs_file_close(fs_file);
return 0;
}
| 0
|
520,357
|
bool Item_param::convert_str_value(THD *thd)
{
bool rc= FALSE;
if (state == STRING_VALUE || state == LONG_DATA_VALUE)
{
rc= value.cs_info.convert_if_needed(thd, &str_value);
/* Here str_value is guaranteed to be in final_character_set_of_str_value */
/*
str_value_ptr is returned from val_str(). It must be not alloced
to prevent it's modification by val_str() invoker.
*/
str_value_ptr.set(str_value.ptr(), str_value.length(),
str_value.charset());
/* Synchronize item charset and length with value charset */
fix_charset_and_length_from_str_value(DERIVATION_COERCIBLE);
}
return rc;
}
| 0
|
222,063
|
Ins_NOT( FT_Long* args )
{
args[0] = !args[0];
}
| 0
|
202,475
|
void Document::DispatchUnloadEvents() {
PluginScriptForbiddenScope forbid_plugin_destructor_scripting;
if (parser_)
parser_->StopParsing();
if (load_event_progress_ == kLoadEventNotRun)
return;
if (load_event_progress_ <= kUnloadEventInProgress) {
Element* current_focused_element = FocusedElement();
if (auto* input = ToHTMLInputElementOrNull(current_focused_element))
input->EndEditing();
if (load_event_progress_ < kPageHideInProgress) {
load_event_progress_ = kPageHideInProgress;
if (LocalDOMWindow* window = domWindow()) {
const double pagehide_event_start = MonotonicallyIncreasingTime();
window->DispatchEvent(
PageTransitionEvent::Create(EventTypeNames::pagehide, false), this);
const double pagehide_event_end = MonotonicallyIncreasingTime();
DEFINE_STATIC_LOCAL(
CustomCountHistogram, pagehide_histogram,
("DocumentEventTiming.PageHideDuration", 0, 10000000, 50));
pagehide_histogram.Count((pagehide_event_end - pagehide_event_start) *
1000000.0);
}
if (!frame_)
return;
mojom::PageVisibilityState visibility_state = GetPageVisibilityState();
load_event_progress_ = kUnloadVisibilityChangeInProgress;
if (visibility_state != mojom::PageVisibilityState::kHidden) {
const double pagevisibility_hidden_event_start =
MonotonicallyIncreasingTime();
DispatchEvent(Event::CreateBubble(EventTypeNames::visibilitychange));
const double pagevisibility_hidden_event_end =
MonotonicallyIncreasingTime();
DEFINE_STATIC_LOCAL(CustomCountHistogram, pagevisibility_histogram,
("DocumentEventTiming.PageVibilityHiddenDuration",
0, 10000000, 50));
pagevisibility_histogram.Count((pagevisibility_hidden_event_end -
pagevisibility_hidden_event_start) *
1000000.0);
DispatchEvent(
Event::CreateBubble(EventTypeNames::webkitvisibilitychange));
}
if (!frame_)
return;
DocumentLoader* document_loader =
frame_->Loader().GetProvisionalDocumentLoader();
load_event_progress_ = kUnloadEventInProgress;
Event* unload_event(Event::Create(EventTypeNames::unload));
if (document_loader && !document_loader->GetTiming().UnloadEventStart() &&
!document_loader->GetTiming().UnloadEventEnd()) {
DocumentLoadTiming& timing = document_loader->GetTiming();
DCHECK(timing.NavigationStart());
const double unload_event_start = MonotonicallyIncreasingTime();
timing.MarkUnloadEventStart(unload_event_start);
frame_->DomWindow()->DispatchEvent(unload_event, this);
const double unload_event_end = MonotonicallyIncreasingTime();
DEFINE_STATIC_LOCAL(
CustomCountHistogram, unload_histogram,
("DocumentEventTiming.UnloadDuration", 0, 10000000, 50));
unload_histogram.Count((unload_event_end - unload_event_start) *
1000000.0);
timing.MarkUnloadEventEnd(unload_event_end);
} else {
frame_->DomWindow()->DispatchEvent(unload_event, frame_->GetDocument());
}
}
load_event_progress_ = kUnloadEventHandled;
}
if (!frame_)
return;
bool keep_event_listeners =
frame_->Loader().GetProvisionalDocumentLoader() &&
frame_->ShouldReuseDefaultView(
frame_->Loader().GetProvisionalDocumentLoader()->Url());
if (!keep_event_listeners)
RemoveAllEventListenersRecursively();
}
| 0
|
224,480
|
WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
PrefService* prefs, bool is_dom_ui) {
WebPreferences web_prefs;
web_prefs.fixed_font_family =
prefs->GetString(prefs::kWebKitFixedFontFamily);
web_prefs.serif_font_family =
prefs->GetString(prefs::kWebKitSerifFontFamily);
web_prefs.sans_serif_font_family =
prefs->GetString(prefs::kWebKitSansSerifFontFamily);
if (prefs->GetBoolean(prefs::kWebKitStandardFontIsSerif))
web_prefs.standard_font_family = web_prefs.serif_font_family;
else
web_prefs.standard_font_family = web_prefs.sans_serif_font_family;
web_prefs.cursive_font_family =
prefs->GetString(prefs::kWebKitCursiveFontFamily);
web_prefs.fantasy_font_family =
prefs->GetString(prefs::kWebKitFantasyFontFamily);
web_prefs.default_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
web_prefs.default_fixed_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
web_prefs.minimum_font_size =
prefs->GetInteger(prefs::kWebKitMinimumFontSize);
web_prefs.minimum_logical_font_size =
prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
web_prefs.default_encoding =
WideToASCII(prefs->GetString(prefs::kDefaultCharset));
web_prefs.javascript_can_open_windows_automatically =
prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically);
web_prefs.dom_paste_enabled =
prefs->GetBoolean(prefs::kWebKitDomPasteEnabled);
web_prefs.shrinks_standalone_images_to_fit =
prefs->GetBoolean(prefs::kWebKitShrinksStandaloneImagesToFit);
web_prefs.inspector_settings = WideToUTF8(
prefs->GetString(prefs::kWebKitInspectorSettings));
{ // Command line switches are used for preferences with no user interface.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
web_prefs.developer_extras_enabled =
!command_line.HasSwitch(switches::kDisableDevTools);
web_prefs.javascript_enabled =
!command_line.HasSwitch(switches::kDisableJavaScript) &&
prefs->GetBoolean(prefs::kWebKitJavascriptEnabled);
web_prefs.web_security_enabled =
!command_line.HasSwitch(switches::kDisableWebSecurity) &&
prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled);
web_prefs.plugins_enabled =
!command_line.HasSwitch(switches::kDisablePlugins) &&
prefs->GetBoolean(prefs::kWebKitPluginsEnabled);
web_prefs.java_enabled =
!command_line.HasSwitch(switches::kDisableJava) &&
prefs->GetBoolean(prefs::kWebKitJavaEnabled);
web_prefs.loads_images_automatically =
!command_line.HasSwitch(switches::kDisableImages) &&
prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically);
web_prefs.uses_page_cache =
command_line.HasSwitch(switches::kEnableFastback);
web_prefs.remote_fonts_enabled =
command_line.HasSwitch(switches::kEnableRemoteFonts);
web_prefs.xss_auditor_enabled =
!command_line.HasSwitch(switches::kDisableXSSAuditor);
web_prefs.application_cache_enabled =
command_line.HasSwitch(switches::kEnableApplicationCache);
web_prefs.local_storage_enabled =
command_line.HasSwitch(switches::kEnableLocalStorage);
web_prefs.databases_enabled =
command_line.HasSwitch(switches::kEnableDatabases);
web_prefs.session_storage_enabled =
command_line.HasSwitch(switches::kEnableSessionStorage);
web_prefs.experimental_webgl_enabled =
command_line.HasSwitch(switches::kEnableExperimentalWebGL);
}
web_prefs.uses_universal_detector =
prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector);
web_prefs.text_areas_are_resizable =
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
web_prefs.default_encoding =
CharacterEncoding::GetCanonicalEncodingNameByAliasName(
web_prefs.default_encoding);
if (web_prefs.default_encoding.empty()) {
prefs->ClearPref(prefs::kDefaultCharset);
web_prefs.default_encoding = WideToASCII(
prefs->GetString(prefs::kDefaultCharset));
}
DCHECK(!web_prefs.default_encoding.empty());
if (is_dom_ui) {
web_prefs.loads_images_automatically = true;
web_prefs.javascript_enabled = true;
}
return web_prefs;
}
| 0
|
66,466
|
static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
bool already_loaded = vmx->loaded_vmcs->cpu == cpu;
if (!already_loaded) {
loaded_vmcs_clear(vmx->loaded_vmcs);
local_irq_disable();
crash_disable_local_vmclear(cpu);
/*
* Read loaded_vmcs->cpu should be before fetching
* loaded_vmcs->loaded_vmcss_on_cpu_link.
* See the comments in __loaded_vmcs_clear().
*/
smp_rmb();
list_add(&vmx->loaded_vmcs->loaded_vmcss_on_cpu_link,
&per_cpu(loaded_vmcss_on_cpu, cpu));
crash_enable_local_vmclear(cpu);
local_irq_enable();
}
if (per_cpu(current_vmcs, cpu) != vmx->loaded_vmcs->vmcs) {
per_cpu(current_vmcs, cpu) = vmx->loaded_vmcs->vmcs;
vmcs_load(vmx->loaded_vmcs->vmcs);
indirect_branch_prediction_barrier();
}
if (!already_loaded) {
void *gdt = get_current_gdt_ro();
unsigned long sysenter_esp;
kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
/*
* Linux uses per-cpu TSS and GDT, so set these when switching
* processors. See 22.2.4.
*/
vmcs_writel(HOST_TR_BASE,
(unsigned long)&get_cpu_entry_area(cpu)->tss.x86_tss);
vmcs_writel(HOST_GDTR_BASE, (unsigned long)gdt); /* 22.2.4 */
/*
* VM exits change the host TR limit to 0x67 after a VM
* exit. This is okay, since 0x67 covers everything except
* the IO bitmap and have have code to handle the IO bitmap
* being lost after a VM exit.
*/
BUILD_BUG_ON(IO_BITMAP_OFFSET - 1 != 0x67);
rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
vmx->loaded_vmcs->cpu = cpu;
}
/* Setup TSC multiplier */
if (kvm_has_tsc_control &&
vmx->current_tsc_ratio != vcpu->arch.tsc_scaling_ratio)
decache_tsc_multiplier(vmx);
vmx_vcpu_pi_load(vcpu, cpu);
vmx->host_pkru = read_pkru();
vmx->host_debugctlmsr = get_debugctlmsr();
}
| 0
|
205,988
|
http2shmlog(const struct http *hp, int t)
{
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
if (t > HTTP_HDR_FIRST)
t = HTTP_HDR_FIRST;
assert(hp->logtag >= HTTP_Rx && hp->logtag <= HTTP_Obj); /*lint !e685*/
assert(t >= HTTP_HDR_REQ && t <= HTTP_HDR_FIRST);
return (logmtx[hp->logtag][t]);
}
| 0
|
336,515
|
static void tcg_out_brcond2 (TCGContext *s, const TCGArg *args,
const int *const_args)
{
tcg_out_cmp2(s, args, const_args);
tcg_out_bc(s, BC | BI(7, CR_EQ) | BO_COND_TRUE, args[5]);
}
| 0
|
393,304
|
xmlRngVErr(xmlRelaxNGValidCtxtPtr ctxt, xmlNodePtr node, int error,
const char *msg, const xmlChar * str1, const xmlChar * str2)
{
xmlStructuredErrorFunc schannel = NULL;
xmlGenericErrorFunc channel = NULL;
void *data = NULL;
if (ctxt != NULL) {
if (ctxt->serror != NULL)
schannel = ctxt->serror;
else
channel = ctxt->error;
data = ctxt->userData;
ctxt->nbErrors++;
}
__xmlRaiseError(schannel, channel, data,
NULL, node, XML_FROM_RELAXNGV,
error, XML_ERR_ERROR, NULL, 0,
(const char *) str1, (const char *) str2, NULL, 0, 0,
msg, str1, str2);
}
| 0
|
423,356
|
void af_alg_data_wakeup(struct sock *sk)
{
struct alg_sock *ask = alg_sk(sk);
struct af_alg_ctx *ctx = ask->private;
struct socket_wq *wq;
if (!ctx->used)
return;
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
EPOLLRDNORM |
EPOLLRDBAND);
sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
rcu_read_unlock();
}
| 0
|
514,797
|
static int test_store_ctx(void)
{
X509_STORE_CTX *sctx = NULL;
X509 *x = NULL;
BIO *bio = NULL;
int testresult = 0, ret;
bio = BIO_new_file(bad_f, "r");
if (bio == NULL)
goto err;
x = PEM_read_bio_X509(bio, NULL, 0, NULL);
if (x == NULL)
goto err;
sctx = X509_STORE_CTX_new();
if (sctx == NULL)
goto err;
if (!X509_STORE_CTX_init(sctx, NULL, x, NULL))
goto err;
/* Verifying a cert where we have no trusted certs should fail */
ret = X509_verify_cert(sctx);
if (ret == 0) {
/* This is the result we were expecting: Test passed */
testresult = 1;
}
err:
X509_STORE_CTX_free(sctx);
X509_free(x);
BIO_free(bio);
return testresult;
}
| 0
|
142,070
|
ParseNodePtr Parser::StaticCreateBinNode(OpCode nop, ParseNodePtr pnode1,
ParseNodePtr pnode2,ArenaAllocator* alloc)
{
DebugOnly(VerifyNodeSize(nop, kcbPnBin));
ParseNodePtr pnode = (ParseNodePtr)alloc->Alloc(kcbPnBin);
InitNode(nop, pnode);
pnode->sxBin.pnodeNext = nullptr;
pnode->sxBin.pnode1 = pnode1;
pnode->sxBin.pnode2 = pnode2;
// Statically detect if the add is a concat
if (!PHASE_OFF1(Js::ByteCodeConcatExprOptPhase))
{
// We can't flatten the concat expression if the LHS is not a flatten concat already
// e.g. a + (<str> + b)
// Side effect of ToStr(b) need to happen first before ToStr(a)
// If we flatten the concat expression, we will do ToStr(a) before ToStr(b)
if ((nop == knopAdd) && (pnode1->CanFlattenConcatExpr() || pnode2->nop == knopStr))
{
pnode->grfpn |= fpnCanFlattenConcatExpr;
}
}
return pnode;
}
| 0
|
150,498
|
void getReadBuffer(void** bufReturn, size_t* lenReturn) override {
*bufReturn = buf_.get() + bytesRead_;
*lenReturn = bufSize_ - bytesRead_;
}
| 0
|
226,825
|
TestURLFetcherFactory::TestURLFetcherFactory() {}
| 0
|
302,494
|
userauth_pubkey(struct ssh *ssh)
{
Authctxt *authctxt = ssh->authctxt;
struct passwd *pw = authctxt->pw;
struct sshbuf *b = NULL;
struct sshkey *key = NULL;
char *pkalg = NULL, *userstyle = NULL, *key_s = NULL, *ca_s = NULL;
u_char *pkblob = NULL, *sig = NULL, have_sig;
size_t blen, slen;
int r, pktype;
int authenticated = 0;
struct sshauthopt *authopts = NULL;
if ((r = sshpkt_get_u8(ssh, &have_sig)) != 0 ||
(r = sshpkt_get_cstring(ssh, &pkalg, NULL)) != 0 ||
(r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0)
fatal("%s: parse request failed: %s", __func__, ssh_err(r));
pktype = sshkey_type_from_name(pkalg);
if (pktype == KEY_UNSPEC) {
/* this is perfectly legal */
verbose("%s: unsupported public key algorithm: %s",
__func__, pkalg);
goto done;
}
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
error("%s: could not parse key: %s", __func__, ssh_err(r));
goto done;
}
if (key == NULL) {
error("%s: cannot decode key: %s", __func__, pkalg);
goto done;
}
if (key->type != pktype) {
error("%s: type mismatch for decoded key "
"(received %d, expected %d)", __func__, key->type, pktype);
goto done;
}
if (sshkey_type_plain(key->type) == KEY_RSA &&
(ssh->compat & SSH_BUG_RSASIGMD5) != 0) {
logit("Refusing RSA key because client uses unsafe "
"signature scheme");
goto done;
}
if (auth2_key_already_used(authctxt, key)) {
logit("refusing previously-used %s key", sshkey_type(key));
goto done;
}
if (match_pattern_list(pkalg, options.pubkey_key_types, 0) != 1) {
logit("%s: key type %s not in PubkeyAcceptedKeyTypes",
__func__, sshkey_ssh_name(key));
goto done;
}
key_s = format_key(key);
if (sshkey_is_cert(key))
ca_s = format_key(key->cert->signature_key);
if (have_sig) {
debug3("%s: have %s signature for %s%s%s",
__func__, pkalg, key_s,
ca_s == NULL ? "" : " CA ",
ca_s == NULL ? "" : ca_s);
if ((r = sshpkt_get_string(ssh, &sig, &slen)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
fatal("%s: %s", __func__, ssh_err(r));
if ((b = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if (ssh->compat & SSH_OLD_SESSIONID) {
if ((r = sshbuf_put(b, session_id2,
session_id2_len)) != 0)
fatal("%s: sshbuf_put session id: %s",
__func__, ssh_err(r));
} else {
if ((r = sshbuf_put_string(b, session_id2,
session_id2_len)) != 0)
fatal("%s: sshbuf_put_string session id: %s",
__func__, ssh_err(r));
}
if (!authctxt->valid || authctxt->user == NULL) {
debug2("%s: disabled because of invalid user",
__func__);
goto done;
}
/* reconstruct packet */
xasprintf(&userstyle, "%s%s%s", authctxt->user,
authctxt->style ? ":" : "",
authctxt->style ? authctxt->style : "");
if ((r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
(r = sshbuf_put_cstring(b, userstyle)) != 0 ||
(r = sshbuf_put_cstring(b, authctxt->service)) != 0 ||
(r = sshbuf_put_cstring(b, "publickey")) != 0 ||
(r = sshbuf_put_u8(b, have_sig)) != 0 ||
(r = sshbuf_put_cstring(b, pkalg) != 0) ||
(r = sshbuf_put_string(b, pkblob, blen)) != 0)
fatal("%s: build packet failed: %s",
__func__, ssh_err(r));
#ifdef DEBUG_PK
sshbuf_dump(b, stderr);
#endif
/* test for correct signature */
authenticated = 0;
if (PRIVSEP(user_key_allowed(ssh, pw, key, 1, &authopts)) &&
PRIVSEP(sshkey_verify(key, sig, slen,
sshbuf_ptr(b), sshbuf_len(b),
(ssh->compat & SSH_BUG_SIGTYPE) == 0 ? pkalg : NULL,
ssh->compat)) == 0) {
authenticated = 1;
}
sshbuf_free(b);
auth2_record_key(authctxt, authenticated, key);
} else {
debug("%s: test pkalg %s pkblob %s%s%s",
__func__, pkalg, key_s,
ca_s == NULL ? "" : " CA ",
ca_s == NULL ? "" : ca_s);
if ((r = sshpkt_get_end(ssh)) != 0)
fatal("%s: %s", __func__, ssh_err(r));
if (!authctxt->valid || authctxt->user == NULL) {
debug2("%s: disabled because of invalid user",
__func__);
goto done;
}
/* XXX fake reply and always send PK_OK ? */
/*
* XXX this allows testing whether a user is allowed
* to login: if you happen to have a valid pubkey this
* message is sent. the message is NEVER sent at all
* if a user is not allowed to login. is this an
* issue? -markus
*/
if (PRIVSEP(user_key_allowed(ssh, pw, key, 0, NULL))) {
if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_PK_OK))
!= 0 ||
(r = sshpkt_put_cstring(ssh, pkalg)) != 0 ||
(r = sshpkt_put_string(ssh, pkblob, blen)) != 0 ||
(r = sshpkt_send(ssh)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
fatal("%s: %s", __func__, ssh_err(r));
authctxt->postponed = 1;
}
}
done:
if (authenticated == 1 && auth_activate_options(ssh, authopts) != 0) {
debug("%s: key options inconsistent with existing", __func__);
authenticated = 0;
}
debug2("%s: authenticated %d pkalg %s", __func__, authenticated, pkalg);
sshauthopt_free(authopts);
sshkey_free(key);
free(userstyle);
free(pkalg);
free(pkblob);
free(key_s);
free(ca_s);
free(sig);
return authenticated;
}
| 0
|
343,632
|
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *max)
{
struct page *page;
struct address_space *mapping;
__be32 *pptr, *curr, *end;
u32 mask, start, len, n;
__be32 val;
int i;
len = *max;
if (!len)
return size;
dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
pptr = kmap(page);
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
i = offset % 32;
offset &= ~(PAGE_CACHE_BITS - 1);
if ((size ^ offset) / PAGE_CACHE_BITS)
end = pptr + PAGE_CACHE_BITS / 32;
else
end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32;
/* scan the first partial u32 for zero bits */
val = *curr;
if (~val) {
n = be32_to_cpu(val);
mask = (1U << 31) >> i;
for (; i < 32; mask >>= 1, i++) {
if (!(n & mask))
goto found;
}
}
curr++;
/* scan complete u32s for the first zero bit */
while (1) {
while (curr < end) {
val = *curr;
if (~val) {
n = be32_to_cpu(val);
mask = 1 << 31;
for (i = 0; i < 32; mask >>= 1, i++) {
if (!(n & mask))
goto found;
}
}
curr++;
}
kunmap(page);
offset += PAGE_CACHE_BITS;
if (offset >= size)
break;
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
NULL);
curr = pptr = kmap(page);
if ((size ^ offset) / PAGE_CACHE_BITS)
end = pptr + PAGE_CACHE_BITS / 32;
else
end = pptr + ((size + 31) & (PAGE_CACHE_BITS - 1)) / 32;
}
dprint(DBG_BITMAP, "bitmap full\n");
start = size;
goto out;
found:
start = offset + (curr - pptr) * 32 + i;
if (start >= size) {
dprint(DBG_BITMAP, "bitmap full\n");
goto out;
}
/* do any partial u32 at the start */
len = min(size - start, len);
while (1) {
n |= mask;
if (++i >= 32)
break;
mask >>= 1;
if (!--len || n & mask)
goto done;
}
if (!--len)
goto done;
*curr++ = cpu_to_be32(n);
/* do full u32s */
while (1) {
while (curr < end) {
n = be32_to_cpu(*curr);
if (len < 32)
goto last;
if (n) {
len = 32;
goto last;
}
*curr++ = cpu_to_be32(0xffffffff);
len -= 32;
}
set_page_dirty(page);
kunmap(page);
offset += PAGE_CACHE_BITS;
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
NULL);
pptr = kmap(page);
curr = pptr;
end = pptr + PAGE_CACHE_BITS / 32;
}
last:
/* do any partial u32 at end */
mask = 1U << 31;
for (i = 0; i < len; i++) {
if (n & mask)
break;
n |= mask;
mask >>= 1;
}
done:
*curr = cpu_to_be32(n);
set_page_dirty(page);
kunmap(page);
*max = offset + (curr - pptr) * 32 + i - start;
HFSPLUS_SB(sb).free_blocks -= *max;
sb->s_dirt = 1;
dprint(DBG_BITMAP, "-> %u,%u\n", start, *max);
out:
mutex_unlock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
return start;
}
| 1
|
214,335
|
gl::GLSurface* GLES2DecoderPassthroughImpl::GetGLSurface() {
return surface_.get();
}
| 0
|
45,537
|
static PHP_METHOD(PDOStatement, nextRowset)
{
PHP_STMT_GET_OBJ;
if (!stmt->methods->next_rowset) {
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver does not support multiple rowsets" TSRMLS_CC);
RETURN_FALSE;
}
PDO_STMT_CLEAR_ERR();
if (!pdo_stmt_do_next_rowset(stmt TSRMLS_CC)) {
PDO_HANDLE_STMT_ERR();
RETURN_FALSE;
}
RETURN_TRUE;
| 0
|
334,391
|
void acpi_memory_unplug_cb(MemHotplugState *mem_st,
DeviceState *dev, Error **errp)
{
MemStatus *mdev;
mdev = acpi_memory_slot_status(mem_st, dev, errp);
if (!mdev) {
return;
}
/* nvdimm device hot unplug is not supported yet. */
assert(!object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM));
mdev->is_enabled = false;
mdev->dimm = NULL;
}
| 0
|
200,076
|
void expectDisplayListEnabled(bool displayListEnabled)
{
EXPECT_EQ(displayListEnabled, (bool)m_testSurface->m_currentFrame.get());
EXPECT_EQ(!displayListEnabled, (bool)m_testSurface->m_fallbackSurface.get());
int expectedSurfaceCreationCount = displayListEnabled ? 0 : 1;
EXPECT_EQ(expectedSurfaceCreationCount, m_surfaceFactory->createSurfaceCount());
}
| 0
|
6,777
|
void *merge_directory_configs(apr_pool_t *mp, void *_parent, void *_child)
{
directory_config *parent = (directory_config *)_parent;
directory_config *child = (directory_config *)_child;
directory_config *merged = create_directory_config(mp, NULL);
#ifdef DEBUG_CONF
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Merge parent %pp child %pp RESULT %pp", _parent, _child, merged);
#endif
if (merged == NULL) return NULL;
/* Use values from the child configuration where possible,
* otherwise use the parent's.
*/
merged->is_enabled = (child->is_enabled == NOT_SET
? parent->is_enabled : child->is_enabled);
/* IO parameters */
merged->reqbody_access = (child->reqbody_access == NOT_SET
? parent->reqbody_access : child->reqbody_access);
merged->reqbody_buffering = (child->reqbody_buffering == NOT_SET
? parent->reqbody_buffering : child->reqbody_buffering);
merged->reqbody_inmemory_limit = (child->reqbody_inmemory_limit == NOT_SET
? parent->reqbody_inmemory_limit : child->reqbody_inmemory_limit);
merged->reqbody_limit = (child->reqbody_limit == NOT_SET
? parent->reqbody_limit : child->reqbody_limit);
merged->reqbody_no_files_limit = (child->reqbody_no_files_limit == NOT_SET
? parent->reqbody_no_files_limit : child->reqbody_no_files_limit);
merged->resbody_access = (child->resbody_access == NOT_SET
? parent->resbody_access : child->resbody_access);
merged->of_limit = (child->of_limit == NOT_SET
? parent->of_limit : child->of_limit);
merged->if_limit_action = (child->if_limit_action == NOT_SET
? parent->if_limit_action : child->if_limit_action);
merged->of_limit_action = (child->of_limit_action == NOT_SET
? parent->of_limit_action : child->of_limit_action);
merged->reqintercept_oe = (child->reqintercept_oe == NOT_SET
? parent->reqintercept_oe : child->reqintercept_oe);
if (child->of_mime_types != NOT_SET_P) {
/* Child added to the table */
if (child->of_mime_types_cleared == 1) {
/* The list of MIME types was cleared in the child,
* which means the parent's MIME types went away and
* we should not take them into consideration here.
*/
merged->of_mime_types = child->of_mime_types;
merged->of_mime_types_cleared = 1;
} else {
/* Add MIME types defined in the child to those
* defined in the parent context.
*/
if (parent->of_mime_types == NOT_SET_P) {
merged->of_mime_types = child->of_mime_types;
merged->of_mime_types_cleared = NOT_SET;
} else {
merged->of_mime_types = apr_table_overlay(mp, parent->of_mime_types,
child->of_mime_types);
if (merged->of_mime_types == NULL) return NULL;
}
}
} else {
/* Child did not add to the table */
if (child->of_mime_types_cleared == 1) {
merged->of_mime_types_cleared = 1;
} else {
merged->of_mime_types = parent->of_mime_types;
merged->of_mime_types_cleared = parent->of_mime_types_cleared;
}
}
/* debug log */
if (child->debuglog_fd == NOT_SET_P) {
merged->debuglog_name = parent->debuglog_name;
merged->debuglog_fd = parent->debuglog_fd;
} else {
merged->debuglog_name = child->debuglog_name;
merged->debuglog_fd = child->debuglog_fd;
}
merged->debuglog_level = (child->debuglog_level == NOT_SET
? parent->debuglog_level : child->debuglog_level);
merged->cookie_format = (child->cookie_format == NOT_SET
? parent->cookie_format : child->cookie_format);
merged->argument_separator = (child->argument_separator == NOT_SET
? parent->argument_separator : child->argument_separator);
merged->cookiev0_separator = (child->cookiev0_separator == NOT_SET_P
? parent->cookiev0_separator : child->cookiev0_separator);
/* rule inheritance */
if ((child->rule_inheritance == NOT_SET)||(child->rule_inheritance == 1)) {
merged->rule_inheritance = parent->rule_inheritance;
if ((child->ruleset == NULL)&&(parent->ruleset == NULL)) {
#ifdef DEBUG_CONF
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "No rules in this context.");
#endif
/* Do nothing, there are no rules in either context. */
} else
if (child->ruleset == NULL) {
#ifdef DEBUG_CONF
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using parent rules in this context.");
#endif
/* Copy the rules from the parent context. */
merged->ruleset = msre_ruleset_create(parent->ruleset->engine, mp);
copy_rules(mp, parent->ruleset, merged->ruleset, child->rule_exceptions);
} else
if (parent->ruleset == NULL) {
#ifdef DEBUG_CONF
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using child rules in this context.");
#endif
/* Copy child rules. */
merged->ruleset = msre_ruleset_create(child->ruleset->engine, mp);
merged->ruleset->phase_request_headers = apr_array_copy(mp,
child->ruleset->phase_request_headers);
merged->ruleset->phase_request_body = apr_array_copy(mp,
child->ruleset->phase_request_body);
merged->ruleset->phase_response_headers = apr_array_copy(mp,
child->ruleset->phase_response_headers);
merged->ruleset->phase_response_body = apr_array_copy(mp,
child->ruleset->phase_response_body);
merged->ruleset->phase_logging = apr_array_copy(mp,
child->ruleset->phase_logging);
} else {
#ifdef DEBUG_CONF
ap_log_perror(APLOG_MARK, APLOG_STARTUP|APLOG_NOERRNO, 0, mp, "Using parent then child rules in this context.");
#endif
/* Copy parent rules, then add child rules to it. */
merged->ruleset = msre_ruleset_create(parent->ruleset->engine, mp);
copy_rules(mp, parent->ruleset, merged->ruleset, child->rule_exceptions);
apr_array_cat(merged->ruleset->phase_request_headers,
child->ruleset->phase_request_headers);
apr_array_cat(merged->ruleset->phase_request_body,
child->ruleset->phase_request_body);
apr_array_cat(merged->ruleset->phase_response_headers,
child->ruleset->phase_response_headers);
apr_array_cat(merged->ruleset->phase_response_body,
child->ruleset->phase_response_body);
apr_array_cat(merged->ruleset->phase_logging,
child->ruleset->phase_logging);
}
} else {
merged->rule_inheritance = 0;
if (child->ruleset != NULL) {
/* Copy child rules. */
merged->ruleset = msre_ruleset_create(child->ruleset->engine, mp);
merged->ruleset->phase_request_headers = apr_array_copy(mp,
child->ruleset->phase_request_headers);
merged->ruleset->phase_request_body = apr_array_copy(mp,
child->ruleset->phase_request_body);
merged->ruleset->phase_response_headers = apr_array_copy(mp,
child->ruleset->phase_response_headers);
merged->ruleset->phase_response_body = apr_array_copy(mp,
child->ruleset->phase_response_body);
merged->ruleset->phase_logging = apr_array_copy(mp,
child->ruleset->phase_logging);
}
}
/* Merge rule exceptions. */
merged->rule_exceptions = apr_array_append(mp, parent->rule_exceptions,
child->rule_exceptions);
merged->hash_method = apr_array_append(mp, parent->hash_method,
child->hash_method);
/* audit log variables */
merged->auditlog_flag = (child->auditlog_flag == NOT_SET
? parent->auditlog_flag : child->auditlog_flag);
merged->auditlog_type = (child->auditlog_type == NOT_SET
? parent->auditlog_type : child->auditlog_type);
merged->max_rule_time = (child->max_rule_time == NOT_SET
? parent->max_rule_time : child->max_rule_time);
merged->auditlog_dirperms = (child->auditlog_dirperms == NOT_SET
? parent->auditlog_dirperms : child->auditlog_dirperms);
merged->auditlog_fileperms = (child->auditlog_fileperms == NOT_SET
? parent->auditlog_fileperms : child->auditlog_fileperms);
if (child->auditlog_fd != NOT_SET_P) {
merged->auditlog_fd = child->auditlog_fd;
merged->auditlog_name = child->auditlog_name;
} else {
merged->auditlog_fd = parent->auditlog_fd;
merged->auditlog_name = parent->auditlog_name;
}
if (child->auditlog2_fd != NOT_SET_P) {
merged->auditlog2_fd = child->auditlog2_fd;
merged->auditlog2_name = child->auditlog2_name;
} else {
merged->auditlog2_fd = parent->auditlog2_fd;
merged->auditlog2_name = parent->auditlog2_name;
}
merged->auditlog_storage_dir = (child->auditlog_storage_dir == NOT_SET_P
? parent->auditlog_storage_dir : child->auditlog_storage_dir);
merged->auditlog_parts = (child->auditlog_parts == NOT_SET_P
? parent->auditlog_parts : child->auditlog_parts);
merged->auditlog_relevant_regex = (child->auditlog_relevant_regex == NOT_SET_P
? parent->auditlog_relevant_regex : child->auditlog_relevant_regex);
/* Upload */
merged->tmp_dir = (child->tmp_dir == NOT_SET_P
? parent->tmp_dir : child->tmp_dir);
merged->upload_dir = (child->upload_dir == NOT_SET_P
? parent->upload_dir : child->upload_dir);
merged->upload_keep_files = (child->upload_keep_files == NOT_SET
? parent->upload_keep_files : child->upload_keep_files);
merged->upload_validates_files = (child->upload_validates_files == NOT_SET
? parent->upload_validates_files : child->upload_validates_files);
merged->upload_filemode = (child->upload_filemode == NOT_SET
? parent->upload_filemode : child->upload_filemode);
merged->upload_file_limit = (child->upload_file_limit == NOT_SET
? parent->upload_file_limit : child->upload_file_limit);
/* Misc */
merged->data_dir = (child->data_dir == NOT_SET_P
? parent->data_dir : child->data_dir);
merged->webappid = (child->webappid == NOT_SET_P
? parent->webappid : child->webappid);
merged->sensor_id = (child->sensor_id == NOT_SET_P
? parent->sensor_id : child->sensor_id);
merged->httpBlkey = (child->httpBlkey == NOT_SET_P
? parent->httpBlkey : child->httpBlkey);
/* Content injection. */
merged->content_injection_enabled = (child->content_injection_enabled == NOT_SET
? parent->content_injection_enabled : child->content_injection_enabled);
/* Stream inspection */
merged->stream_inbody_inspection = (child->stream_inbody_inspection == NOT_SET
? parent->stream_inbody_inspection : child->stream_inbody_inspection);
merged->stream_outbody_inspection = (child->stream_outbody_inspection == NOT_SET
? parent->stream_outbody_inspection : child->stream_outbody_inspection);
/* Geo Lookup */
merged->geo = (child->geo == NOT_SET_P
? parent->geo : child->geo);
/* Gsb Lookup */
merged->gsb = (child->gsb == NOT_SET_P
? parent->gsb : child->gsb);
/* Unicode Map */
merged->u_map = (child->u_map == NOT_SET_P
? parent->u_map : child->u_map);
/* Cache */
merged->cache_trans = (child->cache_trans == NOT_SET
? parent->cache_trans : child->cache_trans);
merged->cache_trans_incremental = (child->cache_trans_incremental == NOT_SET
? parent->cache_trans_incremental : child->cache_trans_incremental);
merged->cache_trans_min = (child->cache_trans_min == (apr_size_t)NOT_SET
? parent->cache_trans_min : child->cache_trans_min);
merged->cache_trans_max = (child->cache_trans_max == (apr_size_t)NOT_SET
? parent->cache_trans_max : child->cache_trans_max);
merged->cache_trans_maxitems = (child->cache_trans_maxitems == (apr_size_t)NOT_SET
? parent->cache_trans_maxitems : child->cache_trans_maxitems);
/* Merge component signatures. */
merged->component_signatures = apr_array_append(mp, parent->component_signatures,
child->component_signatures);
merged->request_encoding = (child->request_encoding == NOT_SET_P
? parent->request_encoding : child->request_encoding);
merged->disable_backend_compression = (child->disable_backend_compression == NOT_SET
? parent->disable_backend_compression : child->disable_backend_compression);
merged->col_timeout = (child->col_timeout == NOT_SET
? parent->col_timeout : child->col_timeout);
/* Hash */
merged->crypto_key = (child->crypto_key == NOT_SET_P
? parent->crypto_key : child->crypto_key);
merged->crypto_key_len = (child->crypto_key_len == NOT_SET
? parent->crypto_key_len : child->crypto_key_len);
merged->crypto_key_add = (child->crypto_key_add == NOT_SET
? parent->crypto_key_add : child->crypto_key_add);
merged->crypto_param_name = (child->crypto_param_name == NOT_SET_P
? parent->crypto_param_name : child->crypto_param_name);
merged->hash_is_enabled = (child->hash_is_enabled == NOT_SET
? parent->hash_is_enabled : child->hash_is_enabled);
merged->hash_enforcement = (child->hash_enforcement == NOT_SET
? parent->hash_enforcement : child->hash_enforcement);
merged->crypto_hash_href_rx = (child->crypto_hash_href_rx == NOT_SET
? parent->crypto_hash_href_rx : child->crypto_hash_href_rx);
merged->crypto_hash_faction_rx = (child->crypto_hash_faction_rx == NOT_SET
? parent->crypto_hash_faction_rx : child->crypto_hash_faction_rx);
merged->crypto_hash_location_rx = (child->crypto_hash_location_rx == NOT_SET
? parent->crypto_hash_location_rx : child->crypto_hash_location_rx);
merged->crypto_hash_iframesrc_rx = (child->crypto_hash_iframesrc_rx == NOT_SET
? parent->crypto_hash_iframesrc_rx : child->crypto_hash_iframesrc_rx);
merged->crypto_hash_framesrc_rx = (child->crypto_hash_framesrc_rx == NOT_SET
? parent->crypto_hash_framesrc_rx : child->crypto_hash_framesrc_rx);
merged->crypto_hash_href_pm = (child->crypto_hash_href_pm == NOT_SET
? parent->crypto_hash_href_pm : child->crypto_hash_href_pm);
merged->crypto_hash_faction_pm = (child->crypto_hash_faction_pm == NOT_SET
? parent->crypto_hash_faction_pm : child->crypto_hash_faction_pm);
merged->crypto_hash_location_pm = (child->crypto_hash_location_pm == NOT_SET
? parent->crypto_hash_location_pm : child->crypto_hash_location_pm);
merged->crypto_hash_iframesrc_pm = (child->crypto_hash_iframesrc_pm == NOT_SET
? parent->crypto_hash_iframesrc_pm : child->crypto_hash_iframesrc_pm);
merged->crypto_hash_framesrc_pm = (child->crypto_hash_framesrc_pm == NOT_SET
? parent->crypto_hash_framesrc_pm : child->crypto_hash_framesrc_pm);
return merged;
}
| 1
|
325,990
|
void cpu_reset (CPUCRISState *env)
{
memset(env, 0, offsetof(CPUCRISState, breakpoints));
tlb_flush(env, 1);
env->pregs[PR_VR] = 32;
#if defined(CONFIG_USER_ONLY)
/* start in user mode with interrupts enabled. */
env->pregs[PR_CCS] |= U_FLAG | I_FLAG;
#else
env->pregs[PR_CCS] = 0;
#endif
| 1
|
188,001
|
void HTMLFormElement::getNamedElements(
const AtomicString& name,
HeapVector<Member<Element>>& namedItems) {
elements()->namedItems(name, namedItems);
Element* elementFromPast = elementFromPastNamesMap(name);
if (namedItems.size() && namedItems.first() != elementFromPast) {
addToPastNamesMap(namedItems.first().get(), name);
} else if (elementFromPast && namedItems.isEmpty()) {
namedItems.append(elementFromPast);
UseCounter::count(document(), UseCounter::FormNameAccessForPastNamesMap);
}
}
| 0
|
181,628
|
WebContentsViewAura::WebContentsViewAura(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate)
: web_contents_(web_contents),
delegate_(delegate),
current_drag_op_(blink::WebDragOperationNone),
drag_dest_delegate_(NULL),
current_rvh_for_drag_(NULL),
overscroll_change_brightness_(false),
current_overscroll_gesture_(OVERSCROLL_NONE),
completed_overscroll_gesture_(OVERSCROLL_NONE),
touch_editable_(TouchEditableImplAura::Create()) {
}
| 0
|
173,647
|
void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
{
if (paintingDisabled())
return;
SkPath path = *pathToClip.platformPath();
if (!isPathSkiaSafe(getCTM(), path))
return;
path.setFillType(clipRule == RULE_EVENODD ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
platformContext()->clipPathAntiAliased(path);
}
| 0
|
322,878
|
static int rv30_decode_mb_info(RV34DecContext *r)
{
static const int rv30_p_types[6] = { RV34_MB_SKIP, RV34_MB_P_16x16, RV34_MB_P_8x8, -1, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
MpegEncContext *s = &r->s;
GetBitContext *gb = &s->gb;
int code = svq3_get_ue_golomb(gb);
if(code > 11){
av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
return -1;
}
if(code > 5){
av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");
code -= 6;
}
if(s->pict_type != AV_PICTURE_TYPE_B)
return rv30_p_types[code];
else
return rv30_b_types[code];
}
| 0
|
121,551
|
static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
{
struct io_ring_ctx *ctx;
int i, hash_bits;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return NULL;
/*
* Use 5 bits less than the max cq entries, that should give us around
* 32 entries per hash list if totally full and uniformly spread.
*/
hash_bits = ilog2(p->cq_entries);
hash_bits -= 5;
if (hash_bits <= 0)
hash_bits = 1;
ctx->cancel_hash_bits = hash_bits;
ctx->cancel_hash = kmalloc((1U << hash_bits) * sizeof(struct hlist_head),
GFP_KERNEL);
if (!ctx->cancel_hash)
goto err;
__hash_init(ctx->cancel_hash, 1U << hash_bits);
ctx->dummy_ubuf = kzalloc(sizeof(*ctx->dummy_ubuf), GFP_KERNEL);
if (!ctx->dummy_ubuf)
goto err;
/* set invalid range, so io_import_fixed() fails meeting it */
ctx->dummy_ubuf->ubuf = -1UL;
ctx->io_buffers = kcalloc(1U << IO_BUFFERS_HASH_BITS,
sizeof(struct list_head), GFP_KERNEL);
if (!ctx->io_buffers)
goto err;
for (i = 0; i < (1U << IO_BUFFERS_HASH_BITS); i++)
INIT_LIST_HEAD(&ctx->io_buffers[i]);
if (percpu_ref_init(&ctx->refs, io_ring_ctx_ref_free,
PERCPU_REF_ALLOW_REINIT, GFP_KERNEL))
goto err;
ctx->flags = p->flags;
init_waitqueue_head(&ctx->sqo_sq_wait);
INIT_LIST_HEAD(&ctx->sqd_list);
INIT_LIST_HEAD(&ctx->cq_overflow_list);
INIT_LIST_HEAD(&ctx->io_buffers_cache);
INIT_LIST_HEAD(&ctx->apoll_cache);
init_completion(&ctx->ref_comp);
xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1);
mutex_init(&ctx->uring_lock);
init_waitqueue_head(&ctx->cq_wait);
spin_lock_init(&ctx->completion_lock);
spin_lock_init(&ctx->timeout_lock);
INIT_WQ_LIST(&ctx->iopoll_list);
INIT_LIST_HEAD(&ctx->io_buffers_pages);
INIT_LIST_HEAD(&ctx->io_buffers_comp);
INIT_LIST_HEAD(&ctx->defer_list);
INIT_LIST_HEAD(&ctx->timeout_list);
INIT_LIST_HEAD(&ctx->ltimeout_list);
spin_lock_init(&ctx->rsrc_ref_lock);
INIT_LIST_HEAD(&ctx->rsrc_ref_list);
INIT_DELAYED_WORK(&ctx->rsrc_put_work, io_rsrc_put_work);
init_llist_head(&ctx->rsrc_put_llist);
INIT_LIST_HEAD(&ctx->tctx_list);
ctx->submit_state.free_list.next = NULL;
INIT_WQ_LIST(&ctx->locked_free_list);
INIT_DELAYED_WORK(&ctx->fallback_work, io_fallback_req_func);
INIT_WQ_LIST(&ctx->submit_state.compl_reqs);
return ctx;
err:
kfree(ctx->dummy_ubuf);
kfree(ctx->cancel_hash);
kfree(ctx->io_buffers);
kfree(ctx);
return NULL;
}
| 0
|
118,127
|
long kvm_arch_vm_ioctl(struct file *filp,
unsigned int ioctl, unsigned long arg)
{
struct kvm *kvm = filp->private_data;
void __user *argp = (void __user *)arg;
int r = -ENOTTY;
/*
* This union makes it completely explicit to gcc-3.x
* that these two variables' stack usage should be
* combined, not added together.
*/
union {
struct kvm_pit_state ps;
struct kvm_pit_state2 ps2;
struct kvm_pit_config pit_config;
} u;
switch (ioctl) {
case KVM_SET_TSS_ADDR:
r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
break;
case KVM_SET_IDENTITY_MAP_ADDR: {
u64 ident_addr;
mutex_lock(&kvm->lock);
r = -EINVAL;
if (kvm->created_vcpus)
goto set_identity_unlock;
r = -EFAULT;
if (copy_from_user(&ident_addr, argp, sizeof(ident_addr)))
goto set_identity_unlock;
r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
set_identity_unlock:
mutex_unlock(&kvm->lock);
break;
}
case KVM_SET_NR_MMU_PAGES:
r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
break;
case KVM_GET_NR_MMU_PAGES:
r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
break;
case KVM_CREATE_IRQCHIP: {
mutex_lock(&kvm->lock);
r = -EEXIST;
if (irqchip_in_kernel(kvm))
goto create_irqchip_unlock;
r = -EINVAL;
if (kvm->created_vcpus)
goto create_irqchip_unlock;
r = kvm_pic_init(kvm);
if (r)
goto create_irqchip_unlock;
r = kvm_ioapic_init(kvm);
if (r) {
kvm_pic_destroy(kvm);
goto create_irqchip_unlock;
}
r = kvm_setup_default_irq_routing(kvm);
if (r) {
kvm_ioapic_destroy(kvm);
kvm_pic_destroy(kvm);
goto create_irqchip_unlock;
}
/* Write kvm->irq_routing before enabling irqchip_in_kernel. */
smp_wmb();
kvm->arch.irqchip_mode = KVM_IRQCHIP_KERNEL;
kvm_clear_apicv_inhibit(kvm, APICV_INHIBIT_REASON_ABSENT);
create_irqchip_unlock:
mutex_unlock(&kvm->lock);
break;
}
case KVM_CREATE_PIT:
u.pit_config.flags = KVM_PIT_SPEAKER_DUMMY;
goto create_pit;
case KVM_CREATE_PIT2:
r = -EFAULT;
if (copy_from_user(&u.pit_config, argp,
sizeof(struct kvm_pit_config)))
goto out;
create_pit:
mutex_lock(&kvm->lock);
r = -EEXIST;
if (kvm->arch.vpit)
goto create_pit_unlock;
r = -ENOMEM;
kvm->arch.vpit = kvm_create_pit(kvm, u.pit_config.flags);
if (kvm->arch.vpit)
r = 0;
create_pit_unlock:
mutex_unlock(&kvm->lock);
break;
case KVM_GET_IRQCHIP: {
/* 0: PIC master, 1: PIC slave, 2: IOAPIC */
struct kvm_irqchip *chip;
chip = memdup_user(argp, sizeof(*chip));
if (IS_ERR(chip)) {
r = PTR_ERR(chip);
goto out;
}
r = -ENXIO;
if (!irqchip_kernel(kvm))
goto get_irqchip_out;
r = kvm_vm_ioctl_get_irqchip(kvm, chip);
if (r)
goto get_irqchip_out;
r = -EFAULT;
if (copy_to_user(argp, chip, sizeof(*chip)))
goto get_irqchip_out;
r = 0;
get_irqchip_out:
kfree(chip);
break;
}
case KVM_SET_IRQCHIP: {
/* 0: PIC master, 1: PIC slave, 2: IOAPIC */
struct kvm_irqchip *chip;
chip = memdup_user(argp, sizeof(*chip));
if (IS_ERR(chip)) {
r = PTR_ERR(chip);
goto out;
}
r = -ENXIO;
if (!irqchip_kernel(kvm))
goto set_irqchip_out;
r = kvm_vm_ioctl_set_irqchip(kvm, chip);
set_irqchip_out:
kfree(chip);
break;
}
case KVM_GET_PIT: {
r = -EFAULT;
if (copy_from_user(&u.ps, argp, sizeof(struct kvm_pit_state)))
goto out;
r = -ENXIO;
if (!kvm->arch.vpit)
goto out;
r = kvm_vm_ioctl_get_pit(kvm, &u.ps);
if (r)
goto out;
r = -EFAULT;
if (copy_to_user(argp, &u.ps, sizeof(struct kvm_pit_state)))
goto out;
r = 0;
break;
}
case KVM_SET_PIT: {
r = -EFAULT;
if (copy_from_user(&u.ps, argp, sizeof(u.ps)))
goto out;
mutex_lock(&kvm->lock);
r = -ENXIO;
if (!kvm->arch.vpit)
goto set_pit_out;
r = kvm_vm_ioctl_set_pit(kvm, &u.ps);
set_pit_out:
mutex_unlock(&kvm->lock);
break;
}
case KVM_GET_PIT2: {
r = -ENXIO;
if (!kvm->arch.vpit)
goto out;
r = kvm_vm_ioctl_get_pit2(kvm, &u.ps2);
if (r)
goto out;
r = -EFAULT;
if (copy_to_user(argp, &u.ps2, sizeof(u.ps2)))
goto out;
r = 0;
break;
}
case KVM_SET_PIT2: {
r = -EFAULT;
if (copy_from_user(&u.ps2, argp, sizeof(u.ps2)))
goto out;
mutex_lock(&kvm->lock);
r = -ENXIO;
if (!kvm->arch.vpit)
goto set_pit2_out;
r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2);
set_pit2_out:
mutex_unlock(&kvm->lock);
break;
}
case KVM_REINJECT_CONTROL: {
struct kvm_reinject_control control;
r = -EFAULT;
if (copy_from_user(&control, argp, sizeof(control)))
goto out;
r = -ENXIO;
if (!kvm->arch.vpit)
goto out;
r = kvm_vm_ioctl_reinject(kvm, &control);
break;
}
case KVM_SET_BOOT_CPU_ID:
r = 0;
mutex_lock(&kvm->lock);
if (kvm->created_vcpus)
r = -EBUSY;
else
kvm->arch.bsp_vcpu_id = arg;
mutex_unlock(&kvm->lock);
break;
#ifdef CONFIG_KVM_XEN
case KVM_XEN_HVM_CONFIG: {
struct kvm_xen_hvm_config xhc;
r = -EFAULT;
if (copy_from_user(&xhc, argp, sizeof(xhc)))
goto out;
r = kvm_xen_hvm_config(kvm, &xhc);
break;
}
case KVM_XEN_HVM_GET_ATTR: {
struct kvm_xen_hvm_attr xha;
r = -EFAULT;
if (copy_from_user(&xha, argp, sizeof(xha)))
goto out;
r = kvm_xen_hvm_get_attr(kvm, &xha);
if (!r && copy_to_user(argp, &xha, sizeof(xha)))
r = -EFAULT;
break;
}
case KVM_XEN_HVM_SET_ATTR: {
struct kvm_xen_hvm_attr xha;
r = -EFAULT;
if (copy_from_user(&xha, argp, sizeof(xha)))
goto out;
r = kvm_xen_hvm_set_attr(kvm, &xha);
break;
}
case KVM_XEN_HVM_EVTCHN_SEND: {
struct kvm_irq_routing_xen_evtchn uxe;
r = -EFAULT;
if (copy_from_user(&uxe, argp, sizeof(uxe)))
goto out;
r = kvm_xen_hvm_evtchn_send(kvm, &uxe);
break;
}
#endif
case KVM_SET_CLOCK:
r = kvm_vm_ioctl_set_clock(kvm, argp);
break;
case KVM_GET_CLOCK:
r = kvm_vm_ioctl_get_clock(kvm, argp);
break;
case KVM_SET_TSC_KHZ: {
u32 user_tsc_khz;
r = -EINVAL;
user_tsc_khz = (u32)arg;
if (kvm_has_tsc_control &&
user_tsc_khz >= kvm_max_guest_tsc_khz)
goto out;
if (user_tsc_khz == 0)
user_tsc_khz = tsc_khz;
WRITE_ONCE(kvm->arch.default_tsc_khz, user_tsc_khz);
r = 0;
goto out;
}
case KVM_GET_TSC_KHZ: {
r = READ_ONCE(kvm->arch.default_tsc_khz);
goto out;
}
case KVM_MEMORY_ENCRYPT_OP: {
r = -ENOTTY;
if (!kvm_x86_ops.mem_enc_ioctl)
goto out;
r = static_call(kvm_x86_mem_enc_ioctl)(kvm, argp);
break;
}
case KVM_MEMORY_ENCRYPT_REG_REGION: {
struct kvm_enc_region region;
r = -EFAULT;
if (copy_from_user(®ion, argp, sizeof(region)))
goto out;
r = -ENOTTY;
if (!kvm_x86_ops.mem_enc_register_region)
goto out;
r = static_call(kvm_x86_mem_enc_register_region)(kvm, ®ion);
break;
}
case KVM_MEMORY_ENCRYPT_UNREG_REGION: {
struct kvm_enc_region region;
r = -EFAULT;
if (copy_from_user(®ion, argp, sizeof(region)))
goto out;
r = -ENOTTY;
if (!kvm_x86_ops.mem_enc_unregister_region)
goto out;
r = static_call(kvm_x86_mem_enc_unregister_region)(kvm, ®ion);
break;
}
case KVM_HYPERV_EVENTFD: {
struct kvm_hyperv_eventfd hvevfd;
r = -EFAULT;
if (copy_from_user(&hvevfd, argp, sizeof(hvevfd)))
goto out;
r = kvm_vm_ioctl_hv_eventfd(kvm, &hvevfd);
break;
}
case KVM_SET_PMU_EVENT_FILTER:
r = kvm_vm_ioctl_set_pmu_event_filter(kvm, argp);
break;
case KVM_X86_SET_MSR_FILTER:
r = kvm_vm_ioctl_set_msr_filter(kvm, argp);
break;
default:
r = -ENOTTY;
}
out:
return r;
}
| 0
|
265,790
|
ByteVectorPrivate(TagLib::uint len, char value) : RefCounter(), data(len, value), size(len) {}
| 0
|
505,131
|
static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
{
tlsextctx * p = (tlsextctx *) arg;
const char * servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
if (servername && p->biodebug)
BIO_printf(p->biodebug,"Hostname in TLS extension: \"%s\"\n",servername);
if (!p->servername)
return SSL_TLSEXT_ERR_NOACK;
if (servername)
{
if (strcmp(servername,p->servername))
return p->extension_error;
if (ctx2)
{
BIO_printf(p->biodebug,"Switching server context.\n");
SSL_set_SSL_CTX(s,ctx2);
}
}
return SSL_TLSEXT_ERR_OK;
}
| 0
|
147,050
|
static ioctl_fn lookup_ioctl(unsigned int cmd, int *ioctl_flags)
{
static const struct {
int cmd;
int flags;
ioctl_fn fn;
} _ioctls[] = {
{DM_VERSION_CMD, 0, NULL}, /* version is dealt with elsewhere */
{DM_REMOVE_ALL_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, remove_all},
{DM_LIST_DEVICES_CMD, 0, list_devices},
{DM_DEV_CREATE_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_create},
{DM_DEV_REMOVE_CMD, IOCTL_FLAGS_NO_PARAMS | IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_remove},
{DM_DEV_RENAME_CMD, IOCTL_FLAGS_ISSUE_GLOBAL_EVENT, dev_rename},
{DM_DEV_SUSPEND_CMD, IOCTL_FLAGS_NO_PARAMS, dev_suspend},
{DM_DEV_STATUS_CMD, IOCTL_FLAGS_NO_PARAMS, dev_status},
{DM_DEV_WAIT_CMD, 0, dev_wait},
{DM_TABLE_LOAD_CMD, 0, table_load},
{DM_TABLE_CLEAR_CMD, IOCTL_FLAGS_NO_PARAMS, table_clear},
{DM_TABLE_DEPS_CMD, 0, table_deps},
{DM_TABLE_STATUS_CMD, 0, table_status},
{DM_LIST_VERSIONS_CMD, 0, list_versions},
{DM_TARGET_MSG_CMD, 0, target_message},
{DM_DEV_SET_GEOMETRY_CMD, 0, dev_set_geometry},
{DM_DEV_ARM_POLL, IOCTL_FLAGS_NO_PARAMS, dev_arm_poll},
{DM_GET_TARGET_VERSION, 0, get_target_version},
};
if (unlikely(cmd >= ARRAY_SIZE(_ioctls)))
return NULL;
*ioctl_flags = _ioctls[cmd].flags;
return _ioctls[cmd].fn;
}
| 0
|
272,749
|
static char *parse_acc(char *p,
struct SYMBOL *s)
{
int pit = 0, acc;
unsigned nacc;
nacc = 0;
for (;;) {
if (nacc >= sizeof s->u.key.pits) {
syntax("Too many accidentals", p);
break;
}
p = parse_acc_pit(p, &pit, &acc);
if (acc < 0)
break;
s->u.key.pits[nacc] = pit;
s->u.key.accs[nacc++] = acc;
while (isspace((unsigned char) *p))
p++;
if (*p == '\0')
break;
if (*p != '^' && *p != '_' && *p != '=')
break;
}
s->u.key.microscale = microscale;
if (s->u.key.empty != 2)
s->u.key.nacc = nacc;
return p;
}
| 0
|
398,672
|
gst_qtdemux_adjust_seek (GstQTDemux * qtdemux, gint64 desired_time,
gboolean use_sparse, gint64 * key_time, gint64 * key_offset)
{
guint64 min_offset;
gint64 min_byte_offset = -1;
gint n;
min_offset = desired_time;
/* for each stream, find the index of the sample in the segment
* and move back to the previous keyframe. */
for (n = 0; n < qtdemux->n_streams; n++) {
QtDemuxStream *str;
guint32 index, kindex;
guint32 seg_idx;
GstClockTime media_start;
GstClockTime media_time;
GstClockTime seg_time;
QtDemuxSegment *seg;
gboolean empty_segment = FALSE;
str = qtdemux->streams[n];
if (str->sparse && !use_sparse)
continue;
seg_idx = gst_qtdemux_find_segment (qtdemux, str, desired_time);
GST_DEBUG_OBJECT (qtdemux, "align segment %d", seg_idx);
/* get segment and time in the segment */
seg = &str->segments[seg_idx];
seg_time = (desired_time - seg->time) * seg->rate;
while (QTSEGMENT_IS_EMPTY (seg)) {
seg_time = 0;
empty_segment = TRUE;
GST_DEBUG_OBJECT (str->pad, "Segment %d is empty, moving to next one",
seg_idx);
seg_idx++;
if (seg_idx == str->n_segments)
break;
seg = &str->segments[seg_idx];
}
if (seg_idx == str->n_segments) {
/* FIXME track shouldn't have the last segment as empty, but if it
* happens we better handle it */
continue;
}
/* get the media time in the segment */
media_start = seg->media_start + seg_time;
/* get the index of the sample with media time */
index = gst_qtdemux_find_index_linear (qtdemux, str, media_start);
GST_DEBUG_OBJECT (qtdemux, "sample for %" GST_TIME_FORMAT " at %u"
" at offset %" G_GUINT64_FORMAT " (empty segment: %d)",
GST_TIME_ARGS (media_start), index, str->samples[index].offset,
empty_segment);
if (!empty_segment) {
/* find previous keyframe */
kindex = gst_qtdemux_find_keyframe (qtdemux, str, index);
/* if the keyframe is at a different position, we need to update the
* requested seek time */
if (index != kindex) {
index = kindex;
/* get timestamp of keyframe */
media_time = QTSAMPLE_DTS (str, &str->samples[kindex]);
GST_DEBUG_OBJECT (qtdemux,
"keyframe at %u with time %" GST_TIME_FORMAT " at offset %"
G_GUINT64_FORMAT, kindex, GST_TIME_ARGS (media_time),
str->samples[kindex].offset);
/* keyframes in the segment get a chance to change the
* desired_offset. keyframes out of the segment are
* ignored. */
if (media_time >= seg->media_start) {
GstClockTime seg_time;
/* this keyframe is inside the segment, convert back to
* segment time */
seg_time = (media_time - seg->media_start) + seg->time;
if (seg_time < min_offset)
min_offset = seg_time;
}
}
}
if (min_byte_offset < 0 || str->samples[index].offset < min_byte_offset)
min_byte_offset = str->samples[index].offset;
}
if (key_time)
*key_time = min_offset;
if (key_offset)
*key_offset = min_byte_offset;
}
| 0
|
384,996
|
PHP_MINFO_FUNCTION(hash)
{
HashPosition pos;
char buffer[2048];
char *s = buffer, *e = s + sizeof(buffer), *str;
ulong idx;
long type;
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTENT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
s += slprintf(s, e - s, "%s ", str);
}
*s = 0;
php_info_print_table_start();
php_info_print_table_row(2, "hash support", "enabled");
php_info_print_table_row(2, "Hashing Engines", buffer);
php_info_print_table_end();
}
| 0
|
16,218
|
static int ptx_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
const uint8_t * buf_end = avpkt -> data + avpkt -> size ;
AVFrame * const p = data ;
unsigned int offset , w , h , y , stride , bytes_per_pixel ;
int ret ;
uint8_t * ptr ;
if ( buf_end - buf < 14 ) return AVERROR_INVALIDDATA ;
offset = AV_RL16 ( buf ) ;
w = AV_RL16 ( buf + 8 ) ;
h = AV_RL16 ( buf + 10 ) ;
bytes_per_pixel = AV_RL16 ( buf + 12 ) >> 3 ;
if ( bytes_per_pixel != 2 ) {
av_log_ask_for_sample ( avctx , "Image format is not RGB15.\n" ) ;
return AVERROR_PATCHWELCOME ;
}
avctx -> pix_fmt = AV_PIX_FMT_RGB555 ;
if ( buf_end - buf < offset ) return AVERROR_INVALIDDATA ;
if ( offset != 0x2c ) av_log_ask_for_sample ( avctx , "offset != 0x2c\n" ) ;
buf += offset ;
if ( ( ret = av_image_check_size ( w , h , 0 , avctx ) ) < 0 ) return ret ;
if ( w != avctx -> width || h != avctx -> height ) avcodec_set_dimensions ( avctx , w , h ) ;
if ( ( ret = ff_get_buffer ( avctx , p , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
p -> pict_type = AV_PICTURE_TYPE_I ;
ptr = p -> data [ 0 ] ;
stride = p -> linesize [ 0 ] ;
for ( y = 0 ;
y < h && buf_end - buf >= w * bytes_per_pixel ;
y ++ ) {
# if HAVE_BIGENDIAN unsigned int x ;
for ( x = 0 ;
x < w * bytes_per_pixel ;
x += bytes_per_pixel ) AV_WN16 ( ptr + x , AV_RL16 ( buf + x ) ) ;
# else memcpy ( ptr , buf , w * bytes_per_pixel ) ;
# endif ptr += stride ;
buf += w * bytes_per_pixel ;
}
* got_frame = 1 ;
if ( y < h ) {
av_log ( avctx , AV_LOG_WARNING , "incomplete packet\n" ) ;
return avpkt -> size ;
}
return offset + w * h * bytes_per_pixel ;
}
| 0
|
419,015
|
system_call_script(thread_master_t *m, int (*func) (thread_t *), void * arg, unsigned long timer, notify_script_t* script)
{
pid_t pid;
/* Daemonization to not degrade our scheduling timer */
#ifdef ENABLE_LOG_TO_FILE
if (log_file_name)
flush_log_file();
#endif
pid = local_fork();
if (pid < 0) {
/* fork error */
log_message(LOG_INFO, "Failed fork process");
return -1;
}
if (pid) {
/* parent process */
thread_add_child(m, func, arg, pid, timer);
return 0;
}
/* Child process */
#ifdef _MEM_CHECK_
skip_mem_dump();
#endif
system_call(script);
exit(0); /* Script errors aren't server errors */
}
| 0
|
208,475
|
void FetchManager::Loader::Failed(const String& message) {
if (failed_ || finished_)
return;
failed_ = true;
if (execution_context_->IsContextDestroyed())
return;
if (!message.IsEmpty()) {
execution_context_->AddConsoleMessage(
ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message));
}
if (resolver_) {
ScriptState* state = resolver_->GetScriptState();
ScriptState::Scope scope(state);
resolver_->Reject(V8ThrowException::CreateTypeError(state->GetIsolate(),
"Failed to fetch"));
}
probe::didFailFetch(execution_context_, this);
NotifyFinished();
}
| 0
|
441,931
|
COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
compat_size_t, sigsetsize)
{
sigset_t set;
if (sigsetsize > sizeof(*uset))
return -EINVAL;
do_sigpending(&set);
return put_compat_sigset(uset, &set, sigsetsize);
}
| 0
|
396,155
|
static int lru_pull_tail(const int orig_id, const int cur_lru,
const uint64_t total_bytes, uint8_t flags) {
item *it = NULL;
int id = orig_id;
int removed = 0;
if (id == 0)
return 0;
int tries = 5;
item *search;
item *next_it;
void *hold_lock = NULL;
unsigned int move_to_lru = 0;
uint64_t limit = 0;
id |= cur_lru;
pthread_mutex_lock(&lru_locks[id]);
search = tails[id];
/* We walk up *only* for locked items, and if bottom is expired. */
for (; tries > 0 && search != NULL; tries--, search=next_it) {
/* we might relink search mid-loop, so search->prev isn't reliable */
next_it = search->prev;
if (search->nbytes == 0 && search->nkey == 0 && search->it_flags == 1) {
/* We are a crawler, ignore it. */
if (flags & LRU_PULL_CRAWL_BLOCKS) {
pthread_mutex_unlock(&lru_locks[id]);
return 0;
}
tries++;
continue;
}
uint32_t hv = hash(ITEM_key(search), search->nkey);
/* Attempt to hash item lock the "search" item. If locked, no
* other callers can incr the refcount. Also skip ourselves. */
if ((hold_lock = item_trylock(hv)) == NULL)
continue;
/* Now see if the item is refcount locked */
if (refcount_incr(&search->refcount) != 2) {
/* Note pathological case with ref'ed items in tail.
* Can still unlink the item, but it won't be reusable yet */
itemstats[id].lrutail_reflocked++;
/* In case of refcount leaks, enable for quick workaround. */
/* WARNING: This can cause terrible corruption */
if (settings.tail_repair_time &&
search->time + settings.tail_repair_time < current_time) {
itemstats[id].tailrepairs++;
search->refcount = 1;
/* This will call item_remove -> item_free since refcnt is 1 */
do_item_unlink_nolock(search, hv);
item_trylock_unlock(hold_lock);
continue;
}
}
/* Expired or flushed */
if ((search->exptime != 0 && search->exptime < current_time)
|| item_is_flushed(search)) {
itemstats[id].reclaimed++;
if ((search->it_flags & ITEM_FETCHED) == 0) {
itemstats[id].expired_unfetched++;
}
/* refcnt 2 -> 1 */
do_item_unlink_nolock(search, hv);
/* refcnt 1 -> 0 -> item_free */
do_item_remove(search);
item_trylock_unlock(hold_lock);
removed++;
/* If all we're finding are expired, can keep going */
continue;
}
/* If we're HOT_LRU or WARM_LRU and over size limit, send to COLD_LRU.
* If we're COLD_LRU, send to WARM_LRU unless we need to evict
*/
switch (cur_lru) {
case HOT_LRU:
limit = total_bytes * settings.hot_lru_pct / 100;
case WARM_LRU:
if (limit == 0)
limit = total_bytes * settings.warm_lru_pct / 100;
if (sizes_bytes[id] > limit) {
itemstats[id].moves_to_cold++;
move_to_lru = COLD_LRU;
do_item_unlink_q(search);
it = search;
removed++;
break;
} else if ((search->it_flags & ITEM_ACTIVE) != 0) {
/* Only allow ACTIVE relinking if we're not too large. */
itemstats[id].moves_within_lru++;
search->it_flags &= ~ITEM_ACTIVE;
do_item_update_nolock(search);
do_item_remove(search);
item_trylock_unlock(hold_lock);
} else {
/* Don't want to move to COLD, not active, bail out */
it = search;
}
break;
case COLD_LRU:
it = search; /* No matter what, we're stopping */
if (flags & LRU_PULL_EVICT) {
if (settings.evict_to_free == 0) {
/* Don't think we need a counter for this. It'll OOM. */
break;
}
itemstats[id].evicted++;
itemstats[id].evicted_time = current_time - search->time;
if (search->exptime != 0)
itemstats[id].evicted_nonzero++;
if ((search->it_flags & ITEM_FETCHED) == 0) {
itemstats[id].evicted_unfetched++;
}
LOGGER_LOG(NULL, LOG_EVICTIONS, LOGGER_EVICTION, search);
do_item_unlink_nolock(search, hv);
removed++;
if (settings.slab_automove == 2) {
slabs_reassign(-1, orig_id);
}
} else if ((search->it_flags & ITEM_ACTIVE) != 0
&& settings.lru_maintainer_thread) {
itemstats[id].moves_to_warm++;
search->it_flags &= ~ITEM_ACTIVE;
move_to_lru = WARM_LRU;
do_item_unlink_q(search);
removed++;
}
break;
}
if (it != NULL)
break;
}
pthread_mutex_unlock(&lru_locks[id]);
if (it != NULL) {
if (move_to_lru) {
it->slabs_clsid = ITEM_clsid(it);
it->slabs_clsid |= move_to_lru;
item_link_q(it);
}
do_item_remove(it);
item_trylock_unlock(hold_lock);
}
return removed;
}
| 0
|
436,675
|
static void option_export_marks(const char *marks)
{
export_marks_file = make_fast_import_path(marks);
}
| 0
|
221,347
|
void TranslateMessageInfoBar::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == button_) {
GetDelegate()->MessageInfoBarButtonPressed();
return;
}
TranslateInfoBarBase::ButtonPressed(sender, event);
}
| 0
|
190,296
|
bt_status_t btif_storage_load_autopair_device_list() {
if (btif_config_has_section(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST)) {
return BT_STATUS_SUCCESS;
}
static const char *key_names[] = {
BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_ADDR,
BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_EXACTNAME,
BTIF_STORAGE_KEY_AUTOPAIR_FIXPIN_KBLIST,
BTIF_STORAGE_KEY_AUTOPAIR_BLACKLIST_PARTIALNAME,
BTIF_STORAGE_KEY_AUTOPAIR_DYNAMIC_BLACKLIST_ADDR,
};
config_t *config = config_new(BTIF_AUTO_PAIR_CONF_FILE);
if (!config) {
LOG_ERROR("%s failed to open auto pair blacklist conf file '%s'.", __func__, BTIF_AUTO_PAIR_CONF_FILE);
return BT_STATUS_FAIL;
}
for (size_t i = 0; i < ARRAY_SIZE(key_names); ++i) {
const char *value = config_get_string(config, CONFIG_DEFAULT_SECTION, key_names[i], NULL);
if (value) {
btif_config_set_str(BTIF_STORAGE_PATH_AUTOPAIR_BLACKLIST, key_names[i], value);
}
}
config_free(config);
return BT_STATUS_SUCCESS;
}
| 0
|
28,305
|
static void pxa2xx_i2c_class_init ( ObjectClass * klass , void * data ) {
DeviceClass * dc = DEVICE_CLASS ( klass ) ;
SysBusDeviceClass * k = SYS_BUS_DEVICE_CLASS ( klass ) ;
k -> init = pxa2xx_i2c_initfn ;
dc -> desc = "PXA2xx I2C Bus Controller" ;
dc -> vmsd = & vmstate_pxa2xx_i2c ;
dc -> props = pxa2xx_i2c_properties ;
}
| 0
|
221,231
|
static IMFSample* CreateInputSample(const uint8* stream, int size,
int min_size, int alignment) {
CHECK(stream);
CHECK_GT(size, 0);
base::win::ScopedComPtr<IMFSample> sample;
sample.Attach(CreateEmptySampleWithBuffer(std::max(min_size, size),
alignment));
RETURN_ON_FAILURE(sample, "Failed to create empty sample", NULL);
base::win::ScopedComPtr<IMFMediaBuffer> buffer;
HRESULT hr = sample->GetBufferByIndex(0, buffer.Receive());
RETURN_ON_HR_FAILURE(hr, "Failed to get buffer from sample", NULL);
DWORD max_length = 0;
DWORD current_length = 0;
uint8* destination = NULL;
hr = buffer->Lock(&destination, &max_length, ¤t_length);
RETURN_ON_HR_FAILURE(hr, "Failed to lock buffer", NULL);
CHECK_EQ(current_length, 0u);
CHECK_GE(static_cast<int>(max_length), size);
memcpy(destination, stream, size);
hr = buffer->Unlock();
RETURN_ON_HR_FAILURE(hr, "Failed to unlock buffer", NULL);
hr = buffer->SetCurrentLength(size);
RETURN_ON_HR_FAILURE(hr, "Failed to set buffer length", NULL);
return sample.Detach();
}
| 0
|
124,118
|
static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
{
struct sock *sk = sock->sk;
int rc;
lock_sock(sk);
rc = __ipx_bind(sock, uaddr, addr_len);
release_sock(sk);
return rc;
}
| 0
|
495,673
|
static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
union pvrdma_cmd_resp *rsp)
{
struct pvrdma_cmd_modify_qp *cmd = &req->modify_qp;
int rc;
/* No need to verify sgid_index since it is u8 */
rc = rdma_rm_modify_qp(&dev->rdma_dev_res, &dev->backend_dev,
cmd->qp_handle, cmd->attr_mask,
cmd->attrs.ah_attr.grh.sgid_index,
(union ibv_gid *)&cmd->attrs.ah_attr.grh.dgid,
cmd->attrs.dest_qp_num,
(enum ibv_qp_state)cmd->attrs.qp_state,
cmd->attrs.qkey, cmd->attrs.rq_psn,
cmd->attrs.sq_psn);
return rc;
}
| 0
|
113,625
|
RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa)
{
return ASN1_d2i_bio_of(RSA,RSA_new,d2i_RSA_PUBKEY,bp,rsa);
}
| 0
|
281,229
|
int64_t GetPrimaryDisplayId() {
return display::Screen::GetScreen()->GetPrimaryDisplay().id();
}
| 0
|
249,595
|
void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType frameLoadType,
HistoryItem* historyItem, HistoryLoadType historyLoadType)
{
ASSERT(m_frame->document());
if (!m_frame->isNavigationAllowed())
return;
if (m_inStopAllLoaders)
return;
if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType)) {
m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resourceRequest(), historyItem, frameLoadType, historyLoadType);
return;
}
FrameLoadRequest request(passedRequest);
request.resourceRequest().setHasUserGesture(UserGestureIndicator::processingUserGesture());
if (!prepareRequestForThisFrame(request))
return;
Frame* targetFrame = request.form() ? nullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()), *m_frame);
if (isBackForwardLoadType(frameLoadType)) {
ASSERT(historyItem);
m_provisionalItem = historyItem;
}
if (targetFrame && targetFrame != m_frame) {
bool wasInSamePage = targetFrame->page() == m_frame->page();
request.setFrameName("_self");
targetFrame->navigate(request);
Page* page = targetFrame->page();
if (!wasInSamePage && page)
page->chromeClient().focus();
return;
}
setReferrerForFrameRequest(request);
FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) ?
determineFrameLoadType(request) : frameLoadType;
NavigationPolicy policy = navigationPolicyForRequest(request);
if (shouldOpenInNewWindow(targetFrame, request, policy)) {
if (policy == NavigationPolicyDownload) {
client()->loadURLExternally(request.resourceRequest(), NavigationPolicyDownload, String(), false);
} else {
request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary);
createWindowForRequest(request, *m_frame, policy);
}
return;
}
const KURL& url = request.resourceRequest().url();
bool sameDocumentHistoryNavigation =
isBackForwardLoadType(newLoadType) && historyLoadType == HistorySameDocumentLoad;
bool sameDocumentNavigation = policy == NavigationPolicyCurrentTab
&& shouldPerformFragmentNavigation(
request.form(), request.resourceRequest().httpMethod(), newLoadType, url);
if (sameDocumentHistoryNavigation || sameDocumentNavigation) {
ASSERT(historyItem || !sameDocumentHistoryNavigation);
RefPtr<SerializedScriptValue> stateObject = sameDocumentHistoryNavigation ?
historyItem->stateObject() : nullptr;
if (!sameDocumentHistoryNavigation) {
m_documentLoader->setNavigationType(determineNavigationType(
newLoadType, false, request.triggeringEvent()));
if (shouldTreatURLAsSameAsCurrent(url))
newLoadType = FrameLoadTypeReplaceCurrentItem;
}
loadInSameDocument(url, stateObject, newLoadType, historyLoadType, request.clientRedirect(), request.originDocument());
return;
}
startLoad(request, newLoadType, policy);
}
| 0
|
91,411
|
static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
struct ib_mad_send_buf **msg)
{
struct ib_mad_agent *mad_agent;
struct ib_mad_send_buf *m;
struct ib_ah *ah;
mad_agent = cm_id_priv->av.port->mad_agent;
ah = ib_create_ah(mad_agent->qp->pd, &cm_id_priv->av.ah_attr);
if (IS_ERR(ah))
return PTR_ERR(ah);
m = ib_create_send_mad(mad_agent, cm_id_priv->id.remote_cm_qpn,
cm_id_priv->av.pkey_index,
0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
GFP_ATOMIC);
if (IS_ERR(m)) {
ib_destroy_ah(ah);
return PTR_ERR(m);
}
/* Timeout set by caller if response is expected. */
m->ah = ah;
m->retries = cm_id_priv->max_cm_retries;
atomic_inc(&cm_id_priv->refcount);
m->context[0] = cm_id_priv;
*msg = m;
return 0;
}
| 0
|
400,303
|
static inline int put_words(OHCIState *ohci,
dma_addr_t addr, uint16_t *buf, int num)
{
int i;
addr += ohci->localmem_base;
for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
uint16_t tmp = cpu_to_le16(*buf);
if (dma_memory_write(ohci->as, addr, &tmp, sizeof(tmp))) {
return -1;
}
}
return 0;
}
| 0
|
202,521
|
void OmniboxEditModel::OnControlKeyChanged(bool pressed) {
if (pressed == (control_key_state_ == UP))
control_key_state_ = pressed ? DOWN_WITHOUT_CHANGE : UP;
}
| 0
|
240,358
|
PanoramiXRenderSetPictureFilter(ClientPtr client)
{
REQUEST(xRenderSetPictureFilterReq);
int result = Success, j;
PanoramiXRes *pict;
REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
FOR_NSCREENS_BACKWARD(j) {
stuff->picture = pict->info[j].id;
result =
(*PanoramiXSaveRenderVector[X_RenderSetPictureFilter]) (client);
if (result != Success)
break;
}
return result;
}
| 0
|
408,853
|
void fli_read_color_2(FILE *f, s_fli_header *fli_header, unsigned char *old_cmap, unsigned char *cmap)
{
unsigned short num_packets, cnt_packets, col_pos;
num_packets=fli_read_short(f);
col_pos=0;
for (cnt_packets=num_packets; cnt_packets>0; cnt_packets--) {
unsigned short skip_col, num_col, col_cnt;
skip_col=fli_read_char(f);
num_col=fli_read_char(f);
if (num_col == 0) {
for (col_pos=0; col_pos<768; col_pos++) {
cmap[col_pos]=fli_read_char(f);
}
return;
}
for (col_cnt=skip_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
cmap[col_pos]=old_cmap[col_pos];col_pos++;
cmap[col_pos]=old_cmap[col_pos];col_pos++;
cmap[col_pos]=old_cmap[col_pos];col_pos++;
}
for (col_cnt=num_col; (col_cnt>0) && (col_pos<768); col_cnt--) {
cmap[col_pos++]=fli_read_char(f);
cmap[col_pos++]=fli_read_char(f);
cmap[col_pos++]=fli_read_char(f);
}
}
}
| 0
|
430,536
|
cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */
{
int bytes, /* Number of bytes written */
field_col; /* Current column */
char *bufptr, /* Pointer into buffer */
*bufend; /* Pointer to end of buffer */
ipp_state_t ipp_state; /* IPP state value */
cupsdLogClient(con, CUPSD_LOG_DEBUG, "con->http=%p", con->http);
cupsdLogClient(con, CUPSD_LOG_DEBUG,
"cupsdWriteClient "
"error=%d, "
"used=%d, "
"state=%s, "
"data_encoding=HTTP_ENCODING_%s, "
"data_remaining=" CUPS_LLFMT ", "
"response=%p(%s), "
"pipe_pid=%d, "
"file=%d",
httpError(con->http), (int)httpGetReady(con->http),
httpStateString(httpGetState(con->http)),
httpIsChunked(con->http) ? "CHUNKED" : "LENGTH",
CUPS_LLCAST httpGetLength2(con->http),
con->response,
con->response ? ippStateString(ippGetState(con->request)) : "",
con->pipe_pid, con->file);
if (httpGetState(con->http) != HTTP_STATE_GET_SEND &&
httpGetState(con->http) != HTTP_STATE_POST_SEND)
{
/*
* If we get called in the wrong state, then something went wrong with the
* connection and we need to shut it down...
*/
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP write state %s.",
httpStateString(httpGetState(con->http)));
cupsdCloseClient(con);
return;
}
if (con->pipe_pid)
{
/*
* Make sure we select on the CGI output...
*/
cupsdAddSelect(con->file, (cupsd_selfunc_t)write_pipe, NULL, con);
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Waiting for CGI data.");
if (!con->file_ready)
{
/*
* Try again later when there is CGI output available...
*/
cupsdRemoveSelect(httpGetFd(con->http));
return;
}
con->file_ready = 0;
}
bytes = (ssize_t)(sizeof(con->header) - (size_t)con->header_used);
if (!con->pipe_pid && bytes > (ssize_t)httpGetRemaining(con->http))
{
/*
* Limit GET bytes to original size of file (STR #3265)...
*/
bytes = (ssize_t)httpGetRemaining(con->http);
}
if (con->response && con->response->state != IPP_STATE_DATA)
{
size_t wused = httpGetPending(con->http); /* Previous write buffer use */
do
{
/*
* Write a single attribute or the IPP message header...
*/
ipp_state = ippWrite(con->http, con->response);
/*
* If the write buffer has been flushed, stop buffering up attributes...
*/
if (httpGetPending(con->http) <= wused)
break;
}
while (ipp_state != IPP_STATE_DATA && ipp_state != IPP_STATE_ERROR);
cupsdLogClient(con, CUPSD_LOG_DEBUG,
"Writing IPP response, ipp_state=%s, old "
"wused=" CUPS_LLFMT ", new wused=" CUPS_LLFMT,
ippStateString(ipp_state),
CUPS_LLCAST wused, CUPS_LLCAST httpGetPending(con->http));
if (httpGetPending(con->http) > 0)
httpFlushWrite(con->http);
bytes = ipp_state != IPP_STATE_ERROR &&
(con->file >= 0 || ipp_state != IPP_STATE_DATA);
cupsdLogClient(con, CUPSD_LOG_DEBUG,
"bytes=%d, http_state=%d, data_remaining=" CUPS_LLFMT,
(int)bytes, httpGetState(con->http),
CUPS_LLCAST httpGetLength2(con->http));
}
else if ((bytes = read(con->file, con->header + con->header_used, (size_t)bytes)) > 0)
{
con->header_used += bytes;
if (con->pipe_pid && !con->got_fields)
{
/*
* Inspect the data for Content-Type and other fields.
*/
for (bufptr = con->header, bufend = con->header + con->header_used,
field_col = 0;
!con->got_fields && bufptr < bufend;
bufptr ++)
{
if (*bufptr == '\n')
{
/*
* Send line to client...
*/
if (bufptr > con->header && bufptr[-1] == '\r')
bufptr[-1] = '\0';
*bufptr++ = '\0';
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Script header: %s", con->header);
if (!con->sent_header)
{
/*
* Handle redirection and CGI status codes...
*/
http_field_t field; /* HTTP field */
char *value = strchr(con->header, ':');
/* Value of field */
if (value)
{
*value++ = '\0';
while (isspace(*value & 255))
value ++;
}
field = httpFieldValue(con->header);
if (field != HTTP_FIELD_UNKNOWN && value)
{
httpSetField(con->http, field, value);
if (field == HTTP_FIELD_LOCATION)
{
con->pipe_status = HTTP_STATUS_SEE_OTHER;
con->sent_header = 2;
}
else
con->sent_header = 1;
}
else if (!_cups_strcasecmp(con->header, "Status") && value)
{
con->pipe_status = (http_status_t)atoi(value);
con->sent_header = 2;
}
else if (!_cups_strcasecmp(con->header, "Set-Cookie") && value)
{
httpSetCookie(con->http, value);
con->sent_header = 1;
}
}
/*
* Update buffer...
*/
con->header_used -= bufptr - con->header;
if (con->header_used > 0)
memmove(con->header, bufptr, (size_t)con->header_used);
bufptr = con->header - 1;
/*
* See if the line was empty...
*/
if (field_col == 0)
{
con->got_fields = 1;
if (httpGetVersion(con->http) == HTTP_VERSION_1_1 &&
!httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0])
httpSetLength(con->http, 0);
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Sending status %d for CGI.", con->pipe_status);
if (con->pipe_status == HTTP_STATUS_OK)
{
if (!cupsdSendHeader(con, con->pipe_status, NULL, CUPSD_AUTH_NONE))
{
cupsdCloseClient(con);
return;
}
}
else
{
if (!cupsdSendError(con, con->pipe_status, CUPSD_AUTH_NONE))
{
cupsdCloseClient(con);
return;
}
}
}
else
field_col = 0;
}
else if (*bufptr != '\r')
field_col ++;
}
if (!con->got_fields)
return;
}
if (con->header_used > 0)
{
if (httpWrite2(con->http, con->header, (size_t)con->header_used) < 0)
{
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing for error %d (%s)",
httpError(con->http), strerror(httpError(con->http)));
cupsdCloseClient(con);
return;
}
if (httpIsChunked(con->http))
httpFlushWrite(con->http);
con->bytes += con->header_used;
if (httpGetState(con->http) == HTTP_STATE_WAITING)
bytes = 0;
else
bytes = con->header_used;
con->header_used = 0;
}
}
if (bytes <= 0 ||
(httpGetState(con->http) != HTTP_STATE_GET_SEND &&
httpGetState(con->http) != HTTP_STATE_POST_SEND))
{
if (!con->sent_header && con->pipe_pid)
cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
else
{
cupsdLogRequest(con, HTTP_STATUS_OK);
if (httpIsChunked(con->http) && (!con->pipe_pid || con->sent_header > 0))
{
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Sending 0-length chunk.");
if (httpWrite2(con->http, "", 0) < 0)
{
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing for error %d (%s)",
httpError(con->http), strerror(httpError(con->http)));
cupsdCloseClient(con);
return;
}
}
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Flushing write buffer.");
httpFlushWrite(con->http);
cupsdLogClient(con, CUPSD_LOG_DEBUG, "New state is %s", httpStateString(httpGetState(con->http)));
}
cupsdAddSelect(httpGetFd(con->http), (cupsd_selfunc_t)cupsdReadClient, NULL, con);
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Waiting for request.");
if (con->file >= 0)
{
cupsdRemoveSelect(con->file);
if (con->pipe_pid)
cupsdEndProcess(con->pipe_pid, 0);
close(con->file);
con->file = -1;
con->pipe_pid = 0;
}
if (con->filename)
{
unlink(con->filename);
cupsdClearString(&con->filename);
}
if (con->request)
{
ippDelete(con->request);
con->request = NULL;
}
if (con->response)
{
ippDelete(con->response);
con->response = NULL;
}
cupsdClearString(&con->command);
cupsdClearString(&con->options);
cupsdClearString(&con->query_string);
if (!httpGetKeepAlive(con->http))
{
cupsdLogClient(con, CUPSD_LOG_DEBUG,
"Closing because Keep-Alive is disabled.");
cupsdCloseClient(con);
return;
}
else
{
cupsArrayRemove(ActiveClients, con);
cupsdSetBusyState(0);
}
}
}
| 0
|
116,330
|
nv_compare(const void *s1, const void *s2)
{
int c1, c2;
// The commands are sorted on absolute value.
c1 = nv_cmds[*(const short *)s1].cmd_char;
c2 = nv_cmds[*(const short *)s2].cmd_char;
if (c1 < 0)
c1 = -c1;
if (c2 < 0)
c2 = -c2;
return c1 - c2;
}
| 0
|
446,878
|
void ldb_set_require_private_event_context(struct ldb_context *ldb)
{
ldb->require_private_event_context = true;
}
| 0
|
222,776
|
static void gen_add_A0_im(DisasContext *s, int val)
{
tcg_gen_addi_tl(cpu_A0, cpu_A0, val);
if (!CODE64(s)) {
tcg_gen_ext32u_tl(cpu_A0, cpu_A0);
}
}
| 0
|
154,039
|
static int compare_thresholds(const void *a, const void *b)
{
const struct mem_cgroup_threshold *_a = a;
const struct mem_cgroup_threshold *_b = b;
return _a->threshold - _b->threshold;
}
| 0
|
9,609
|
const Cluster* Segment::GetLast() const
{
if ((m_clusters == NULL) || (m_clusterCount <= 0))
return &m_eos;
const long idx = m_clusterCount - 1;
Cluster* const pCluster = m_clusters[idx];
assert(pCluster);
return pCluster;
}
| 1
|
12,810
|
bool ContainOnlyOneKeyboardLayout(
const ImeConfigValue& value) {
return (value.type == ImeConfigValue::kValueTypeStringList &&
value.string_list_value.size() == 1 &&
chromeos::input_method::IsKeyboardLayout(
value.string_list_value[0]));
}
| 1
|
208,117
|
PHP_METHOD(snmp, getnext)
{
php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_GETNEXT, (-1));
}
| 0
|
170,463
|
PrintMsg_Print_Params CalculatePrintParamsForCss(
WebKit::WebFrame* frame,
int page_index,
const PrintMsg_Print_Params& page_params,
bool ignore_css_margins,
bool fit_to_page,
double* scale_factor) {
PrintMsg_Print_Params css_params = GetCssPrintParams(frame, page_index,
page_params);
PrintMsg_Print_Params params = page_params;
EnsureOrientationMatches(css_params, ¶ms);
if (ignore_css_margins && fit_to_page)
return params;
PrintMsg_Print_Params result_params = css_params;
if (ignore_css_margins) {
result_params.margin_top = params.margin_top;
result_params.margin_left = params.margin_left;
DCHECK(!fit_to_page);
int default_margin_right = params.page_size.width() -
params.content_size.width() - params.margin_left;
int default_margin_bottom = params.page_size.height() -
params.content_size.height() - params.margin_top;
result_params.content_size = gfx::Size(
result_params.page_size.width() - result_params.margin_left -
default_margin_right,
result_params.page_size.height() - result_params.margin_top -
default_margin_bottom);
}
if (fit_to_page) {
double factor = FitPrintParamsToPage(params, &result_params);
if (scale_factor)
*scale_factor = factor;
}
return result_params;
}
| 0
|
306,093
|
static long do_locks(unsigned int fd, unsigned int cmd,
unsigned long arg)
{
struct flock64 kernel;
struct oabi_flock64 user;
mm_segment_t fs;
long ret;
if (copy_from_user(&user, (struct oabi_flock64 __user *)arg,
sizeof(user)))
return -EFAULT;
kernel.l_type = user.l_type;
kernel.l_whence = user.l_whence;
kernel.l_start = user.l_start;
kernel.l_len = user.l_len;
kernel.l_pid = user.l_pid;
fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_fcntl64(fd, cmd, (unsigned long)&kernel);
set_fs(fs);
if (!ret && (cmd == F_GETLK64 || cmd == F_OFD_GETLK)) {
user.l_type = kernel.l_type;
user.l_whence = kernel.l_whence;
user.l_start = kernel.l_start;
user.l_len = kernel.l_len;
user.l_pid = kernel.l_pid;
if (copy_to_user((struct oabi_flock64 __user *)arg,
&user, sizeof(user)))
ret = -EFAULT;
}
return ret;
}
| 0
|
220,206
|
static void spl_filesystem_dir_open(spl_filesystem_object* intern, char *path TSRMLS_DC)
{
int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS);
intern->type = SPL_FS_DIR;
intern->_path_len = strlen(path);
intern->u.dir.dirp = php_stream_opendir(path, REPORT_ERRORS, FG(default_context));
if (intern->_path_len > 1 && IS_SLASH_AT(path, intern->_path_len-1)) {
intern->_path = estrndup(path, --intern->_path_len);
} else {
intern->_path = estrndup(path, intern->_path_len);
}
intern->u.dir.index = 0;
if (EG(exception) || intern->u.dir.dirp == NULL) {
intern->u.dir.entry.d_name[0] = '\0';
if (!EG(exception)) {
/* open failed w/out notice (turned to exception due to EH_THROW) */
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0
TSRMLS_CC, "Failed to open directory \"%s\"", path);
}
} else {
do {
spl_filesystem_dir_read(intern TSRMLS_CC);
} while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name));
}
}
| 0
|
191,274
|
int ChromeMockRenderThread::print_preview_pages_remaining() {
int ChromeMockRenderThread::print_preview_pages_remaining() const {
return print_preview_pages_remaining_;
}
| 0
|
288,943
|
static void maybe_exit ( int error ) {
if ( ! first_error ) first_error = error ;
if ( ignore_errors ) return ;
ignore_errors = 1 ;
if ( opt_slave_data ) do_start_slave_sql ( mysql ) ;
if ( mysql ) mysql_close ( mysql ) ;
free_resources ( ) ;
exit ( error ) ;
}
| 0
|
471,569
|
char *ldbGetSourceLine(int line) {
int idx = line-1;
if (idx < 0 || idx >= ldb.lines) return "<out of range source code line>";
return ldb.src[idx];
}
| 0
|
489,791
|
ds->tile_dep_id_merged = GF_TRUE;
if (ds->rep->dependency_id) gf_free(ds->rep->dependency_id);
ds->rep->dependency_id = gf_strdup(base_ds->merged_tile_dep->rep->id);
}
}
static void dasher_check_bitstream_swicthing(GF_DasherCtx *ctx, GF_MPD_AdaptationSet *set)
{
u32 i, j, count;
Bool use_inband = ((ctx->bs_switch==DASHER_BS_SWITCH_INBAND) || (ctx->bs_switch==DASHER_BS_SWITCH_INBAND_PPS)) ? GF_TRUE : GF_FALSE;
Bool use_multi = (ctx->bs_switch==DASHER_BS_SWITCH_MULTI) ? GF_TRUE : GF_FALSE;
GF_MPD_Representation *base_rep = gf_list_get(set->representations, 0);
GF_DashStream *base_ds;
switch (ctx->muxtype) {
case DASHER_MUX_TS:
case DASHER_MUX_OGG:
case DASHER_MUX_RAW:
set->bitstream_switching = GF_TRUE;
return;
//other formats use an init segment
default:
break;
}
if (ctx->bs_switch==DASHER_BS_SWITCH_OFF) return;
if (!base_rep) return;
base_ds = base_rep->playback.udta;
count = gf_list_count(set->representations);
if (count==1) {
if (ctx->bs_switch==DASHER_BS_SWITCH_FORCE) set->bitstream_switching=GF_TRUE;
else if (use_inband) {
if (base_ds->codec_id==GF_CODECID_VVC) {
base_ds->inband_params = (ctx->bs_switch==DASHER_BS_SWITCH_INBAND_PPS) ? 2 : 1;
} else {
base_ds->inband_params = 1;
}
}
return;
}
for (i=1; i<count; i++) {
GF_MPD_Representation *rep = gf_list_get(set->representations, i);
GF_DashStream *ds = rep->playback.udta;
//same codec ID
if (ds->codec_id == base_ds->codec_id) {
//we will use inband params, so bs switching is OK
if (use_inband || use_multi) continue;
//we have deps, cannot use bitstream switching except for merged tile base
if (ds->dep_id) {
if (ds->codec_id==GF_CODECID_HEVC_TILES) {
u32 id;
GF_DashStream *tile_base = get_base_ds(ctx, ds);
if (!tile_base) return;
id = tile_base->merged_tile_dep ? tile_base->merged_tile_dep->id : tile_base->id;
if (base_ds->dep_id==id) continue;
}
return;
}
//we consider we can switch in non-inband only if we have same CRC for the decoder config
if (base_ds->dsi_crc == ds->dsi_crc) continue;
//not the same config, no BS switching
return;
}
//dependencies / different codec IDs, cannot use bitstream switching
return;
}
//ok we can use BS switching, ensure we use the same timescale for every stream
set->bitstream_switching = GF_TRUE;
for (i=0; i<count; i++) {
GF_MPD_Representation *rep = gf_list_get(set->representations, i);
GF_DashStream *ds = rep->playback.udta;
if (base_ds->tile_base && ds->tile_base && (base_ds != ds) ) {
ds->merged_tile_dep = base_ds;
if (ds->rep) {
gf_list_rem(set->representations, i);
i--;
count--;
gf_mpd_representation_free(ds->rep);
ds->rep = NULL;
//switch dependencyID of all reps depending on this one to the new base
rewrite_dep_ids(ctx, ds);
//and ignore this rep while flushing segments
base_ds->nb_rep--;
}
}
for (j=i+1; j<count; j++) {
GF_DashStream *a_ds;
rep = gf_list_get(set->representations, j);
| 0
|
73,355
|
static int ip_vs_genl_dump_service(struct sk_buff *skb,
struct ip_vs_service *svc,
struct netlink_callback *cb)
{
void *hdr;
hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
&ip_vs_genl_family, NLM_F_MULTI,
IPVS_CMD_NEW_SERVICE);
if (!hdr)
return -EMSGSIZE;
if (ip_vs_genl_fill_service(skb, svc) < 0)
goto nla_put_failure;
return genlmsg_end(skb, hdr);
nla_put_failure:
genlmsg_cancel(skb, hdr);
return -EMSGSIZE;
}
| 0
|
199,190
|
void GLES2DecoderImpl::LoseContext(uint32 reset_status) {
if (reset_status_ != GL_NO_ERROR) {
return;
}
if (workarounds().use_virtualized_gl_contexts) {
if (reset_status == GL_GUILTY_CONTEXT_RESET_ARB) {
reset_status = GL_UNKNOWN_CONTEXT_RESET_ARB;
}
} else if (reset_status == GL_UNKNOWN_CONTEXT_RESET_ARB &&
IsRobustnessSupported()) {
GLenum driver_status = glGetGraphicsResetStatusARB();
if (driver_status == GL_GUILTY_CONTEXT_RESET_ARB ||
driver_status == GL_INNOCENT_CONTEXT_RESET_ARB) {
reset_status = driver_status;
}
}
reset_status_ = reset_status;
current_decoder_error_ = error::kLostContext;
}
| 0
|
433,238
|
ax25_cb *ax25_create_cb(void)
{
ax25_cb *ax25;
if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
return NULL;
refcount_set(&ax25->refcount, 1);
skb_queue_head_init(&ax25->write_queue);
skb_queue_head_init(&ax25->frag_queue);
skb_queue_head_init(&ax25->ack_queue);
skb_queue_head_init(&ax25->reseq_queue);
ax25_setup_timers(ax25);
ax25_fillin_cb(ax25, NULL);
ax25->state = AX25_STATE_0;
return ax25;
}
| 0
|
17,708
|
static void prplcb_conv_write ( PurpleConversation * conv , const char * who , const char * alias , const char * message , PurpleMessageFlags flags , time_t mtime ) {
if ( flags & PURPLE_MESSAGE_SEND ) {
handle_conv_msg ( conv , who , message , OPT_SELFMESSAGE , mtime ) ;
}
}
| 0
|
381,069
|
static void ram_migration_cancel(void *opaque)
{
migration_end();
}
| 0
|
139,031
|
void __exit bnep_sock_cleanup(void)
{
if (bt_sock_unregister(BTPROTO_BNEP) < 0)
BT_ERR("Can't unregister BNEP socket");
proto_unregister(&bnep_proto);
}
| 0
|
232,250
|
bool readArrayBuffer(v8::Handle<v8::Value>* value)
{
RefPtr<ArrayBuffer> arrayBuffer = doReadArrayBuffer();
if (!arrayBuffer)
return false;
*value = toV8(arrayBuffer.release(), m_scriptState->context()->Global(), isolate());
return true;
}
| 0
|
424,531
|
copy_opt_map_info(OptMapInfo* to, OptMapInfo* from)
{
*to = *from;
}
| 0
|
286,448
|
static void withScriptStateVoidExceptionMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectV8Internal::withScriptStateVoidExceptionMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
361,048
|
int find_service(fstring service)
{
int iService;
struct smbd_server_connection *sconn = smbd_server_conn;
all_string_sub(service,"\\","/",0);
iService = lp_servicenumber(service);
/* now handle the special case of a home directory */
if (iService < 0) {
char *phome_dir = get_user_home_dir(talloc_tos(), service);
if(!phome_dir) {
/*
* Try mapping the servicename, it may
* be a Windows to unix mapped user name.
*/
if(map_username(sconn, service))
phome_dir = get_user_home_dir(
talloc_tos(), service);
}
DEBUG(3,("checking for home directory %s gave %s\n",service,
phome_dir?phome_dir:"(NULL)"));
iService = add_home_service(service,service /* 'username' */, phome_dir);
}
/* If we still don't have a service, attempt to add it as a printer. */
if (iService < 0) {
int iPrinterService;
if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) {
iPrinterService = load_registry_service(PRINTERS_NAME);
}
if (iPrinterService) {
DEBUG(3,("checking whether %s is a valid printer name...\n", service));
if (pcap_printername_ok(service)) {
DEBUG(3,("%s is a valid printer name\n", service));
DEBUG(3,("adding %s as a printer service\n", service));
lp_add_printer(service, iPrinterService);
iService = lp_servicenumber(service);
if (iService < 0) {
DEBUG(0,("failed to add %s as a printer service!\n", service));
}
} else {
DEBUG(3,("%s is not a valid printer name\n", service));
}
}
}
/* Check for default vfs service? Unsure whether to implement this */
if (iService < 0) {
}
if (iService < 0) {
iService = load_registry_service(service);
}
/* Is it a usershare service ? */
if (iService < 0 && *lp_usershare_path()) {
/* Ensure the name is canonicalized. */
strlower_m(service);
iService = load_usershare_service(service);
}
/* just possibly it's a default service? */
if (iService < 0) {
char *pdefservice = lp_defaultservice();
if (pdefservice && *pdefservice && !strequal(pdefservice,service) && !strstr_m(service,"..")) {
/*
* We need to do a local copy here as lp_defaultservice()
* returns one of the rotating lp_string buffers that
* could get overwritten by the recursive find_service() call
* below. Fix from Josef Hinteregger <joehtg@joehtg.co.at>.
*/
char *defservice = SMB_STRDUP(pdefservice);
if (!defservice) {
goto fail;
}
/* Disallow anything except explicit share names. */
if (strequal(defservice,HOMES_NAME) ||
strequal(defservice, PRINTERS_NAME) ||
strequal(defservice, "IPC$")) {
SAFE_FREE(defservice);
goto fail;
}
iService = find_service(defservice);
if (iService >= 0) {
all_string_sub(service, "_","/",0);
iService = lp_add_service(service, iService);
}
SAFE_FREE(defservice);
}
}
if (iService >= 0) {
if (!VALID_SNUM(iService)) {
DEBUG(0,("Invalid snum %d for %s\n",iService, service));
iService = -1;
}
}
fail:
if (iService < 0)
DEBUG(3,("find_service() failed to find service %s\n", service));
return (iService);
}
| 0
|
183,744
|
BluetoothSocketCreateFunction::BluetoothSocketCreateFunction() {}
| 0
|
23,523
|
static int rv34_decode_inter_mb_header ( RV34DecContext * r , int8_t * intra_types ) {
MpegEncContext * s = & r -> s ;
GetBitContext * gb = & s -> gb ;
int mb_pos = s -> mb_x + s -> mb_y * s -> mb_stride ;
int i , t ;
r -> block_type = r -> decode_mb_info ( r ) ;
if ( r -> block_type == - 1 ) return - 1 ;
s -> current_picture_ptr -> mb_type [ mb_pos ] = rv34_mb_type_to_lavc [ r -> block_type ] ;
r -> mb_type [ mb_pos ] = r -> block_type ;
if ( r -> block_type == RV34_MB_SKIP ) {
if ( s -> pict_type == AV_PICTURE_TYPE_P ) r -> mb_type [ mb_pos ] = RV34_MB_P_16x16 ;
if ( s -> pict_type == AV_PICTURE_TYPE_B ) r -> mb_type [ mb_pos ] = RV34_MB_B_DIRECT ;
}
r -> is16 = ! ! IS_INTRA16x16 ( s -> current_picture_ptr -> mb_type [ mb_pos ] ) ;
rv34_decode_mv ( r , r -> block_type ) ;
if ( r -> block_type == RV34_MB_SKIP ) {
fill_rectangle ( intra_types , 4 , 4 , r -> intra_types_stride , 0 , sizeof ( intra_types [ 0 ] ) ) ;
return 0 ;
}
r -> chroma_vlc = 1 ;
r -> luma_vlc = 0 ;
if ( IS_INTRA ( s -> current_picture_ptr -> mb_type [ mb_pos ] ) ) {
if ( r -> is16 ) {
t = get_bits ( gb , 2 ) ;
fill_rectangle ( intra_types , 4 , 4 , r -> intra_types_stride , t , sizeof ( intra_types [ 0 ] ) ) ;
r -> luma_vlc = 2 ;
}
else {
if ( r -> decode_intra_types ( r , gb , intra_types ) < 0 ) return - 1 ;
r -> luma_vlc = 1 ;
}
r -> chroma_vlc = 0 ;
r -> cur_vlcs = choose_vlc_set ( r -> si . quant , r -> si . vlc_set , 0 ) ;
}
else {
for ( i = 0 ;
i < 16 ;
i ++ ) intra_types [ ( i & 3 ) + ( i >> 2 ) * r -> intra_types_stride ] = 0 ;
r -> cur_vlcs = choose_vlc_set ( r -> si . quant , r -> si . vlc_set , 1 ) ;
if ( r -> mb_type [ mb_pos ] == RV34_MB_P_MIX16x16 ) {
r -> is16 = 1 ;
r -> chroma_vlc = 1 ;
r -> luma_vlc = 2 ;
r -> cur_vlcs = choose_vlc_set ( r -> si . quant , r -> si . vlc_set , 0 ) ;
}
}
return rv34_decode_cbp ( gb , r -> cur_vlcs , r -> is16 ) ;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.