unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
100,645 | 0 | RenderObject* TextAutosizer::nextInPreOrderSkippingDescendantsOfContainers(const RenderObject* current, const RenderObject* stayWithin)
{
if (current == stayWithin || !isAutosizingContainer(current))
for (RenderObject* child = current->firstChild(); child; child = child->nextSibling())
return child;
for (const RenderObject* ancestor = current; ancestor; ancestor = ancestor->parent()) {
if (ancestor == stayWithin)
return 0;
for (RenderObject* sibling = ancestor->nextSibling(); sibling; sibling = sibling->nextSibling())
return sibling;
}
return 0;
}
| 9,500 |
88,776 | 0 | static void Process_ipfix_option_data(exporter_ipfix_domain_t *exporter, void *data_flowset, FlowSource_t *fs) {
option_offset_t *offset_table;
uint32_t id;
uint8_t *in;
id = GET_FLOWSET_ID(data_flowset);
offset_table = fs->option_offset_table;
while ( offset_table && offset_table->id != id )
offset_table = offset_table->next;
if ( !offset_table ) {
LogError( "Process_ipfix: Panic! - No Offset table found! : %s line %d", __FILE__, __LINE__);
return;
}
#ifdef DEVEL
uint32_t size_left = GET_FLOWSET_LENGTH(data_flowset) - 4; // -4 for data flowset header -> id and length
dbg_printf("[%u] Process option data flowset size: %u\n", exporter->info.id, size_left);
#endif
in = (uint8_t *)(data_flowset + 4); // skip flowset header
if ( TestFlag(offset_table->flags, HAS_SAMPLER_DATA) ) {
int32_t id;
uint16_t mode;
uint32_t interval;
if (offset_table->sampler_id_length == 2) {
id = Get_val16((void *)&in[offset_table->offset_id]);
} else {
id = in[offset_table->offset_id];
}
mode = offset_table->offset_mode ? in[offset_table->offset_mode] : 0;
interval = Get_val32((void *)&in[offset_table->offset_interval]);
InsertSampler(fs, exporter, id, mode, interval);
dbg_printf("Extracted Sampler data:\n");
dbg_printf("Sampler ID : %u\n", id);
dbg_printf("Sampler mode : %u\n", mode);
dbg_printf("Sampler interval: %u\n", interval);
}
if ( TestFlag(offset_table->flags, HAS_STD_SAMPLER_DATA) ) {
int32_t id = -1;
uint16_t mode = offset_table->offset_std_sampler_algorithm ? in[offset_table->offset_std_sampler_algorithm] : 0;
uint32_t interval = Get_val32((void *)&in[offset_table->offset_std_sampler_interval]);
InsertSampler(fs, exporter, id, mode, interval);
dbg_printf("Extracted Std Sampler data:\n");
dbg_printf("Sampler ID : %i\n", id);
dbg_printf("Sampler algorithm: %u\n", mode);
dbg_printf("Sampler interval : %u\n", interval);
dbg_printf("Set std sampler: algorithm: %u, interval: %u\n",
mode, interval);
}
processed_records++;
} // End of Process_ipfix_option_data
| 9,501 |
11,805 | 0 | polling_inhibitor_disconnected_cb (Inhibitor *inhibitor,
Device *device)
{
device->priv->polling_inhibitors = g_list_remove (device->priv->polling_inhibitors, inhibitor);
g_signal_handlers_disconnect_by_func (inhibitor, polling_inhibitor_disconnected_cb, device);
g_object_unref (inhibitor);
update_info (device);
drain_pending_changes (device, FALSE);
daemon_local_update_poller (device->priv->daemon);
}
| 9,502 |
169,648 | 0 | void VerifyProcessIsForegrounded(WebContents* web_contents) {
constexpr bool kExpectedIsBackground = false;
VerifyProcessPriority(web_contents->GetMainFrame()->GetProcess(),
kExpectedIsBackground);
}
| 9,503 |
137,939 | 0 | Document* AXLayoutObject::getDocument() const {
if (!getLayoutObject())
return nullptr;
return &getLayoutObject()->document();
}
| 9,504 |
62,122 | 0 | LosslessReduceDepthOK(Image *image)
{
/* Reduce bit depth if it can be reduced losslessly from 16+ to 8.
*
* This is true if the high byte and the next highest byte of
* each sample of the image, the colormap, and the background color
* are equal to each other. We check this by seeing if the samples
* are unchanged when we scale them down to 8 and back up to Quantum.
*
* We don't use the method GetImageDepth() because it doesn't check
* background and doesn't handle PseudoClass specially.
*/
#define QuantumToCharToQuantumEqQuantum(quantum) \
((ScaleCharToQuantum((unsigned char) ScaleQuantumToChar(quantum))) == quantum)
MagickBooleanType
ok_to_reduce=MagickFalse;
if (image->depth >= 16)
{
const PixelPacket
*p;
ok_to_reduce=
QuantumToCharToQuantumEqQuantum(image->background_color.red) &&
QuantumToCharToQuantumEqQuantum(image->background_color.green) &&
QuantumToCharToQuantumEqQuantum(image->background_color.blue) ?
MagickTrue : MagickFalse;
if (ok_to_reduce != MagickFalse && image->storage_class == PseudoClass)
{
int indx;
for (indx=0; indx < (ssize_t) image->colors; indx++)
{
ok_to_reduce=(
QuantumToCharToQuantumEqQuantum(
image->colormap[indx].red) &&
QuantumToCharToQuantumEqQuantum(
image->colormap[indx].green) &&
QuantumToCharToQuantumEqQuantum(
image->colormap[indx].blue)) ?
MagickTrue : MagickFalse;
if (ok_to_reduce == MagickFalse)
break;
}
}
if ((ok_to_reduce != MagickFalse) &&
(image->storage_class != PseudoClass))
{
ssize_t
y;
register ssize_t
x;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
{
ok_to_reduce = MagickFalse;
break;
}
for (x=(ssize_t) image->columns-1; x >= 0; x--)
{
ok_to_reduce=
QuantumToCharToQuantumEqQuantum(GetPixelRed(p)) &&
QuantumToCharToQuantumEqQuantum(GetPixelGreen(p)) &&
QuantumToCharToQuantumEqQuantum(GetPixelBlue(p)) ?
MagickTrue : MagickFalse;
if (ok_to_reduce == MagickFalse)
break;
p++;
}
if (x >= 0)
break;
}
}
if (ok_to_reduce != MagickFalse)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" OK to reduce PNG bit depth to 8 without loss of info");
}
else
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Not OK to reduce PNG bit depth to 8 without loss of info");
}
}
return ok_to_reduce;
}
| 9,505 |
71,242 | 0 | void kvm_set_pfn_dirty(kvm_pfn_t pfn)
{
if (!kvm_is_reserved_pfn(pfn)) {
struct page *page = pfn_to_page(pfn);
if (!PageReserved(page))
SetPageDirty(page);
}
}
| 9,506 |
170,646 | 0 | void NsDisable(preproc_effect_t *effect)
{
ALOGV("NsDisable");
webrtc::NoiseSuppression *ns = static_cast<webrtc::NoiseSuppression *>(effect->engine);
ns->Enable(false);
}
| 9,507 |
6,808 | 0 | enum act_return http_action_reject(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
channel_abort(&s->req);
channel_abort(&s->res);
s->req.analysers = 0;
s->res.analysers = 0;
HA_ATOMIC_ADD(&s->be->be_counters.denied_req, 1);
HA_ATOMIC_ADD(&sess->fe->fe_counters.denied_req, 1);
if (sess->listener && sess->listener->counters)
HA_ATOMIC_ADD(&sess->listener->counters->denied_req, 1);
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_PRXCOND;
if (!(s->flags & SF_FINST_MASK))
s->flags |= SF_FINST_R;
return ACT_RET_CONT;
}
| 9,508 |
152,018 | 0 | void RenderFrameHostImpl::OnBeforeUnloadACK(
bool proceed,
const base::TimeTicks& renderer_before_unload_start_time,
const base::TimeTicks& renderer_before_unload_end_time) {
ProcessBeforeUnloadACK(proceed, false /* treat_as_final_ack */,
renderer_before_unload_start_time,
renderer_before_unload_end_time);
}
| 9,509 |
25,982 | 0 | static void cpu_clock_event_read(struct perf_event *event)
{
cpu_clock_event_update(event);
}
| 9,510 |
6,617 | 0 | check_file_permissions_reduced(i_ctx_t *i_ctx_p, const char *fname, int len,
const char *permitgroup)
{
long i;
ref *permitlist = NULL;
/* an empty string (first character == 0) if '\' character is */
/* recognized as a file name separator as on DOS & Windows */
const char *win_sep2 = "\\";
bool use_windows_pathsep = (gs_file_name_check_separator(win_sep2, 1, win_sep2) == 1);
uint plen = gp_file_name_parents(fname, len);
/* Assuming a reduced file name. */
if (dict_find_string(&(i_ctx_p->userparams), permitgroup, &permitlist) <= 0)
return 0; /* if Permissions not found, just allow access */
for (i=0; i<r_size(permitlist); i++) {
ref permitstring;
const string_match_params win_filename_params = {
'*', '?', '\\', true, true /* ignore case & '/' == '\\' */
};
const byte *permstr;
uint permlen;
int cwd_len = 0;
if (array_get(imemory, permitlist, i, &permitstring) < 0 ||
r_type(&permitstring) != t_string
)
break; /* any problem, just fail */
permstr = permitstring.value.bytes;
permlen = r_size(&permitstring);
/*
* Check if any file name is permitted with "*".
*/
if (permlen == 1 && permstr[0] == '*')
return 0; /* success */
/*
* If the filename starts with parent references,
* the permission element must start with same number of parent references.
*/
if (plen != 0 && plen != gp_file_name_parents((const char *)permstr, permlen))
continue;
cwd_len = gp_file_name_cwds((const char *)permstr, permlen);
/*
* If the permission starts with "./", absolute paths
* are not permitted.
*/
if (cwd_len > 0 && gp_file_name_is_absolute(fname, len))
continue;
/*
* If the permission starts with "./", relative paths
* with no "./" are allowed as well as with "./".
* 'fname' has no "./" because it is reduced.
*/
if (string_match( (const unsigned char*) fname, len,
permstr + cwd_len, permlen - cwd_len,
use_windows_pathsep ? &win_filename_params : NULL))
return 0; /* success */
}
/* not found */
return gs_error_invalidfileaccess;
}
| 9,511 |
167,466 | 0 | MojoResult DataPipeConsumerDispatcher::AddWatcherRef(
const scoped_refptr<WatcherDispatcher>& watcher,
uintptr_t context) {
base::AutoLock lock(lock_);
if (is_closed_ || in_transit_)
return MOJO_RESULT_INVALID_ARGUMENT;
return watchers_.Add(watcher, context, GetHandleSignalsStateNoLock());
}
| 9,512 |
161,111 | 0 | void MediaStreamManager::DeleteRequest(const std::string& label) {
DVLOG(1) << "DeleteRequest({label= " << label << "})";
for (DeviceRequests::iterator request_it = requests_.begin();
request_it != requests_.end(); ++request_it) {
if (request_it->first == label) {
std::unique_ptr<DeviceRequest> request(request_it->second);
requests_.erase(request_it);
return;
}
}
NOTREACHED();
}
| 9,513 |
138,408 | 0 | void Document::close(ExceptionState& exceptionState)
{
if (importLoader()) {
exceptionState.throwDOMException(InvalidStateError, "Imported document doesn't support close().");
return;
}
if (!scriptableDocumentParser() || !scriptableDocumentParser()->wasCreatedByScript() || !scriptableDocumentParser()->isParsing())
return;
explicitClose();
}
| 9,514 |
155,365 | 0 | void ChromeContentBrowserClient::GetSchemesBypassingSecureContextCheckWhitelist(
std::set<std::string>* schemes) {
*schemes = secure_origin_whitelist::GetSchemesBypassingSecureContextCheck();
}
| 9,515 |
12,655 | 0 | expand_check_condition(uschar *condition, uschar *m1, uschar *m2)
{
int rc;
uschar *ss = expand_string(condition);
if (ss == NULL)
{
if (!expand_string_forcedfail && !search_find_defer)
log_write(0, LOG_MAIN|LOG_PANIC, "failed to expand condition \"%s\" "
"for %s %s: %s", condition, m1, m2, expand_string_message);
return FALSE;
}
rc = ss[0] != 0 && Ustrcmp(ss, "0") != 0 && strcmpic(ss, US"no") != 0 &&
strcmpic(ss, US"false") != 0;
return rc;
}
| 9,516 |
20,884 | 0 | gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access)
{
gpa_t t_gpa;
struct x86_exception exception;
BUG_ON(!mmu_is_nested(vcpu));
/* NPT walks are always user-walks */
access |= PFERR_USER_MASK;
t_gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, gpa, access, &exception);
return t_gpa;
}
| 9,517 |
164,545 | 0 | static const Mem *columnNullValue(void){
/* Even though the Mem structure contains an element
** of type i64, on certain architectures (x86) with certain compiler
** switches (-Os), gcc may align this Mem object on a 4-byte boundary
** instead of an 8-byte one. This all works fine, except that when
** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
** that a Mem structure is located on an 8-byte boundary. To prevent
** these assert()s from failing, when building with SQLITE_DEBUG defined
** using gcc, we force nullMem to be 8-byte aligned using the magical
** __attribute__((aligned(8))) macro. */
static const Mem nullMem
#if defined(SQLITE_DEBUG) && defined(__GNUC__)
__attribute__((aligned(8)))
#endif
= {
/* .u = */ {0},
/* .flags = */ (u16)MEM_Null,
/* .enc = */ (u8)0,
/* .eSubtype = */ (u8)0,
/* .n = */ (int)0,
/* .z = */ (char*)0,
/* .zMalloc = */ (char*)0,
/* .szMalloc = */ (int)0,
/* .uTemp = */ (u32)0,
/* .db = */ (sqlite3*)0,
/* .xDel = */ (void(*)(void*))0,
#ifdef SQLITE_DEBUG
/* .pScopyFrom = */ (Mem*)0,
/* .mScopyFlags= */ 0,
#endif
};
return &nullMem;
}
| 9,518 |
29,483 | 0 | int oz_cdev_init(void)
{
oz_app_enable(OZ_APPID_SERIAL, 1);
return 0;
}
| 9,519 |
50,390 | 0 | posix_acl_xattr_get(const struct xattr_handler *handler,
struct dentry *unused, struct inode *inode,
const char *name, void *value, size_t size)
{
struct posix_acl *acl;
int error;
if (!IS_POSIXACL(inode))
return -EOPNOTSUPP;
if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
acl = get_acl(inode, handler->flags);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
return -ENODATA;
error = posix_acl_to_xattr(&init_user_ns, acl, value, size);
posix_acl_release(acl);
return error;
}
| 9,520 |
87,815 | 0 | R_API void r_core_cmd_help(const RCore *core, const char *help[]) {
r_cons_cmd_help (help, core->print->flags & R_PRINT_FLAGS_COLOR);
}
| 9,521 |
141,854 | 0 | void KioskNextHomeInterfaceBrokerImpl::GetIdentityAccessor(
::identity::mojom::IdentityAccessorRequest request) {
connector_->BindInterface(::identity::mojom::kServiceName,
std::move(request));
}
| 9,522 |
125,022 | 0 | bool RenderFlexibleBox::hasAutoMarginsInCrossAxis(RenderBox* child) const
{
if (isHorizontalFlow())
return child->style()->marginTop().isAuto() || child->style()->marginBottom().isAuto();
return child->style()->marginLeft().isAuto() || child->style()->marginRight().isAuto();
}
| 9,523 |
82,344 | 0 | NO_INLINE JsVar *jspeBlockOrStatement() {
if (lex->tk=='{') {
jspeBlock();
return 0;
} else {
JsVar *v = jspeStatement();
if (lex->tk==';') JSP_ASSERT_MATCH(';');
return v;
}
}
/** Parse using current lexer until we hit the end of
* input or there was some problem. */
NO_INLINE JsVar *jspParse() {
JsVar *v = 0;
while (!JSP_SHOULDNT_PARSE && lex->tk != LEX_EOF) {
jsvUnLock(v);
v = jspeBlockOrStatement();
}
return v;
}
NO_INLINE JsVar *jspeStatementVar() {
JsVar *lastDefined = 0;
/* variable creation. TODO - we need a better way of parsing the left
* hand side. Maybe just have a flag called can_create_var that we
* set and then we parse as if we're doing a normal equals.*/
assert(lex->tk==LEX_R_VAR || lex->tk==LEX_R_LET || lex->tk==LEX_R_CONST);
jslGetNextToken();
bool hasComma = true; // for first time in loop
while (hasComma && lex->tk == LEX_ID && !jspIsInterrupted()) {
JsVar *a = 0;
if (JSP_SHOULD_EXECUTE) {
a = jspeiFindOnTop(jslGetTokenValueAsString(lex), true);
if (!a) { // out of memory
jspSetError(false);
return lastDefined;
}
}
JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_ID, jsvUnLock(a), lastDefined);
if (lex->tk == '=') {
JsVar *var;
JSP_MATCH_WITH_CLEANUP_AND_RETURN('=', jsvUnLock(a), lastDefined);
var = jsvSkipNameAndUnLock(jspeAssignmentExpression());
if (JSP_SHOULD_EXECUTE)
jsvReplaceWith(a, var);
jsvUnLock(var);
}
jsvUnLock(lastDefined);
lastDefined = a;
hasComma = lex->tk == ',';
if (hasComma) JSP_MATCH_WITH_RETURN(',', lastDefined);
}
return lastDefined;
}
NO_INLINE JsVar *jspeStatementIf() {
bool cond;
JsVar *var, *result = 0;
JSP_ASSERT_MATCH(LEX_R_IF);
JSP_MATCH('(');
var = jspeExpression();
if (JSP_SHOULDNT_PARSE) return var;
JSP_MATCH(')');
cond = JSP_SHOULD_EXECUTE && jsvGetBoolAndUnLock(jsvSkipName(var));
jsvUnLock(var);
JSP_SAVE_EXECUTE();
if (!cond) jspSetNoExecute();
JsVar *a = jspeBlockOrStatement();
if (!cond) {
jsvUnLock(a);
JSP_RESTORE_EXECUTE();
} else {
result = a;
}
if (lex->tk==LEX_R_ELSE) {
JSP_ASSERT_MATCH(LEX_R_ELSE);
JSP_SAVE_EXECUTE();
if (cond) jspSetNoExecute();
JsVar *a = jspeBlockOrStatement();
if (cond) {
jsvUnLock(a);
JSP_RESTORE_EXECUTE();
} else {
result = a;
}
}
return result;
}
NO_INLINE JsVar *jspeStatementSwitch() {
JSP_ASSERT_MATCH(LEX_R_SWITCH);
JSP_MATCH('(');
JsVar *switchOn = jspeExpression();
JSP_SAVE_EXECUTE();
bool execute = JSP_SHOULD_EXECUTE;
JSP_MATCH_WITH_CLEANUP_AND_RETURN(')', jsvUnLock(switchOn), 0);
if (!execute) { jsvUnLock(switchOn); jspeBlock(); return 0; }
JSP_MATCH_WITH_CLEANUP_AND_RETURN('{', jsvUnLock(switchOn), 0);
bool executeDefault = true;
if (execute) execInfo.execute=EXEC_NO|EXEC_IN_SWITCH;
while (lex->tk==LEX_R_CASE) {
JSP_MATCH_WITH_CLEANUP_AND_RETURN(LEX_R_CASE, jsvUnLock(switchOn), 0);
JsExecFlags oldFlags = execInfo.execute;
if (execute) execInfo.execute=EXEC_YES|EXEC_IN_SWITCH;
JsVar *test = jspeAssignmentExpression();
execInfo.execute = oldFlags|EXEC_IN_SWITCH;;
JSP_MATCH_WITH_CLEANUP_AND_RETURN(':', jsvUnLock2(switchOn, test), 0);
bool cond = false;
if (execute)
cond = jsvGetBoolAndUnLock(jsvMathsOpSkipNames(switchOn, test, LEX_TYPEEQUAL));
if (cond) executeDefault = false;
jsvUnLock(test);
if (cond && (execInfo.execute&EXEC_RUN_MASK)==EXEC_NO)
execInfo.execute=EXEC_YES|EXEC_IN_SWITCH;
while (!JSP_SHOULDNT_PARSE && lex->tk!=LEX_EOF && lex->tk!=LEX_R_CASE && lex->tk!=LEX_R_DEFAULT && lex->tk!='}')
jsvUnLock(jspeBlockOrStatement());
oldExecute |= execInfo.execute & (EXEC_ERROR_MASK|EXEC_RETURN); // copy across any errors/exceptions/returns
}
jsvUnLock(switchOn);
if (execute && (execInfo.execute&EXEC_RUN_MASK)==EXEC_BREAK) {
execInfo.execute=EXEC_YES|EXEC_IN_SWITCH;
} else {
executeDefault = true;
}
JSP_RESTORE_EXECUTE();
if (lex->tk==LEX_R_DEFAULT) {
JSP_ASSERT_MATCH(LEX_R_DEFAULT);
JSP_MATCH(':');
JSP_SAVE_EXECUTE();
if (!executeDefault) jspSetNoExecute();
else execInfo.execute |= EXEC_IN_SWITCH;
while (!JSP_SHOULDNT_PARSE && lex->tk!=LEX_EOF && lex->tk!='}')
jsvUnLock(jspeBlockOrStatement());
oldExecute |= execInfo.execute & (EXEC_ERROR_MASK|EXEC_RETURN); // copy across any errors/exceptions/returns
execInfo.execute = execInfo.execute & (JsExecFlags)~EXEC_BREAK;
JSP_RESTORE_EXECUTE();
}
JSP_MATCH('}');
| 9,524 |
152,516 | 0 | void RenderFrameImpl::SendUpdateFaviconURL() {
if (frame_->Parent())
return;
blink::WebIconURL::Type icon_types_mask =
static_cast<blink::WebIconURL::Type>(
blink::WebIconURL::kTypeFavicon |
blink::WebIconURL::kTypeTouchPrecomposed |
blink::WebIconURL::kTypeTouch);
WebVector<blink::WebIconURL> icon_urls = frame_->IconURLs(icon_types_mask);
if (icon_urls.empty())
return;
std::vector<FaviconURL> urls;
urls.reserve(icon_urls.size());
for (const blink::WebIconURL& icon_url : icon_urls) {
urls.push_back(FaviconURL(icon_url.GetIconURL(),
ToFaviconType(icon_url.IconType()),
ConvertToFaviconSizes(icon_url.Sizes())));
}
DCHECK_EQ(icon_urls.size(), urls.size());
Send(new FrameHostMsg_UpdateFaviconURL(GetRoutingID(), urls));
}
| 9,525 |
121,879 | 0 | net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!system_url_request_context_getter_.get()) {
InitSystemRequestContext();
}
return system_url_request_context_getter_.get();
}
| 9,526 |
38,214 | 0 | get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
{
unsigned long address = (unsigned long)uaddr;
struct mm_struct *mm = current->mm;
struct page *page, *page_head;
int err, ro = 0;
/*
* The futex address must be "naturally" aligned.
*/
key->both.offset = address % PAGE_SIZE;
if (unlikely((address % sizeof(u32)) != 0))
return -EINVAL;
address -= key->both.offset;
if (unlikely(!access_ok(rw, uaddr, sizeof(u32))))
return -EFAULT;
/*
* PROCESS_PRIVATE futexes are fast.
* As the mm cannot disappear under us and the 'key' only needs
* virtual address, we dont even have to find the underlying vma.
* Note : We do have to check 'uaddr' is a valid user address,
* but access_ok() should be faster than find_vma()
*/
if (!fshared) {
key->private.mm = mm;
key->private.address = address;
get_futex_key_refs(key); /* implies MB (B) */
return 0;
}
again:
err = get_user_pages_fast(address, 1, 1, &page);
/*
* If write access is not required (eg. FUTEX_WAIT), try
* and get read-only access.
*/
if (err == -EFAULT && rw == VERIFY_READ) {
err = get_user_pages_fast(address, 1, 0, &page);
ro = 1;
}
if (err < 0)
return err;
else
err = 0;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
page_head = page;
if (unlikely(PageTail(page))) {
put_page(page);
/* serialize against __split_huge_page_splitting() */
local_irq_disable();
if (likely(__get_user_pages_fast(address, 1, !ro, &page) == 1)) {
page_head = compound_head(page);
/*
* page_head is valid pointer but we must pin
* it before taking the PG_lock and/or
* PG_compound_lock. The moment we re-enable
* irqs __split_huge_page_splitting() can
* return and the head page can be freed from
* under us. We can't take the PG_lock and/or
* PG_compound_lock on a page that could be
* freed from under us.
*/
if (page != page_head) {
get_page(page_head);
put_page(page);
}
local_irq_enable();
} else {
local_irq_enable();
goto again;
}
}
#else
page_head = compound_head(page);
if (page != page_head) {
get_page(page_head);
put_page(page);
}
#endif
lock_page(page_head);
/*
* If page_head->mapping is NULL, then it cannot be a PageAnon
* page; but it might be the ZERO_PAGE or in the gate area or
* in a special mapping (all cases which we are happy to fail);
* or it may have been a good file page when get_user_pages_fast
* found it, but truncated or holepunched or subjected to
* invalidate_complete_page2 before we got the page lock (also
* cases which we are happy to fail). And we hold a reference,
* so refcount care in invalidate_complete_page's remove_mapping
* prevents drop_caches from setting mapping to NULL beneath us.
*
* The case we do have to guard against is when memory pressure made
* shmem_writepage move it from filecache to swapcache beneath us:
* an unlikely race, but we do need to retry for page_head->mapping.
*/
if (!page_head->mapping) {
int shmem_swizzled = PageSwapCache(page_head);
unlock_page(page_head);
put_page(page_head);
if (shmem_swizzled)
goto again;
return -EFAULT;
}
/*
* Private mappings are handled in a simple way.
*
* NOTE: When userspace waits on a MAP_SHARED mapping, even if
* it's a read-only handle, it's expected that futexes attach to
* the object not the particular process.
*/
if (PageAnon(page_head)) {
/*
* A RO anonymous page will never change and thus doesn't make
* sense for futex operations.
*/
if (ro) {
err = -EFAULT;
goto out;
}
key->both.offset |= FUT_OFF_MMSHARED; /* ref taken on mm */
key->private.mm = mm;
key->private.address = address;
} else {
key->both.offset |= FUT_OFF_INODE; /* inode-based key */
key->shared.inode = page_head->mapping->host;
key->shared.pgoff = basepage_index(page);
}
get_futex_key_refs(key); /* implies MB (B) */
out:
unlock_page(page_head);
put_page(page_head);
return err;
}
| 9,527 |
118,284 | 0 | void AutofillDialogViews::OnWidgetBoundsChanged(views::Widget* widget,
const gfx::Rect& new_bounds) {
if (error_bubble_ && error_bubble_->GetWidget() == widget)
return;
if (sign_in_delegate_ && sign_in_web_view_->visible()) {
sign_in_delegate_->UpdateLimitsAndEnableAutoResize(
GetMinimumSignInViewSize(), GetMaximumSignInViewSize());
}
HideErrorBubble();
}
| 9,528 |
1,884 | 0 | static void reds_handle_read_link_done(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
SpiceLinkMess *link_mess = link->link_mess;
AsyncRead *obj = &link->async_read;
uint32_t num_caps = link_mess->num_common_caps + link_mess->num_channel_caps;
uint32_t *caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset);
int auth_selection;
if (num_caps && (num_caps * sizeof(uint32_t) + link_mess->caps_offset >
link->link_header.size ||
link_mess->caps_offset < sizeof(*link_mess))) {
reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
reds_link_free(link);
return;
}
auth_selection = test_capabilty(caps, link_mess->num_common_caps,
SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
if (!reds_security_check(link)) {
if (link->stream->ssl) {
spice_warning("spice channels %d should not be encrypted", link_mess->channel_type);
reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED);
} else {
spice_warning("spice channels %d should be encrypted", link_mess->channel_type);
reds_send_link_error(link, SPICE_LINK_ERR_NEED_SECURED);
}
reds_link_free(link);
return;
}
if (!reds_send_link_ack(link)) {
reds_link_free(link);
return;
}
if (!auth_selection) {
if (sasl_enabled && !link->skip_auth) {
spice_warning("SASL enabled, but peer supports only spice authentication");
reds_send_link_error(link, SPICE_LINK_ERR_VERSION_MISMATCH);
return;
}
spice_warning("Peer doesn't support AUTH selection");
reds_get_spice_ticket(link);
} else {
obj->now = (uint8_t *)&link->auth_mechanism;
obj->end = obj->now + sizeof(SpiceLinkAuthMechanism);
obj->done = reds_handle_auth_mechanism;
async_read_handler(0, 0, &link->async_read);
}
}
| 9,529 |
59,673 | 0 | static void csnmp_host_definition_destroy(void *arg) /* {{{ */
{
host_definition_t *hd;
hd = arg;
if (hd == NULL)
return;
if (hd->name != NULL) {
DEBUG("snmp plugin: Destroying host definition for host `%s'.", hd->name);
}
csnmp_host_close_session(hd);
sfree(hd->name);
sfree(hd->address);
sfree(hd->community);
sfree(hd->username);
sfree(hd->auth_passphrase);
sfree(hd->priv_passphrase);
sfree(hd->context);
sfree(hd->data_list);
sfree(hd);
} /* }}} void csnmp_host_definition_destroy */
| 9,530 |
36,224 | 0 | static void mntput_no_expire(struct mount *mnt)
{
put_again:
rcu_read_lock();
mnt_add_count(mnt, -1);
if (likely(mnt->mnt_ns)) { /* shouldn't be the last one */
rcu_read_unlock();
return;
}
lock_mount_hash();
if (mnt_get_count(mnt)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
if (unlikely(mnt->mnt_pinned)) {
mnt_add_count(mnt, mnt->mnt_pinned + 1);
mnt->mnt_pinned = 0;
rcu_read_unlock();
unlock_mount_hash();
acct_auto_close_mnt(&mnt->mnt);
goto put_again;
}
if (unlikely(mnt->mnt.mnt_flags & MNT_DOOMED)) {
rcu_read_unlock();
unlock_mount_hash();
return;
}
mnt->mnt.mnt_flags |= MNT_DOOMED;
rcu_read_unlock();
list_del(&mnt->mnt_instance);
unlock_mount_hash();
/*
* This probably indicates that somebody messed
* up a mnt_want/drop_write() pair. If this
* happens, the filesystem was probably unable
* to make r/w->r/o transitions.
*/
/*
* The locking used to deal with mnt_count decrement provides barriers,
* so mnt_get_writers() below is safe.
*/
WARN_ON(mnt_get_writers(mnt));
fsnotify_vfsmount_delete(&mnt->mnt);
dput(mnt->mnt.mnt_root);
deactivate_super(mnt->mnt.mnt_sb);
mnt_free_id(mnt);
call_rcu(&mnt->mnt_rcu, delayed_free_vfsmnt);
}
| 9,531 |
575 | 0 | pdf_init_csi(fz_context *ctx, pdf_csi *csi, pdf_document *doc, pdf_obj *rdb, pdf_lexbuf *buf, fz_cookie *cookie)
{
memset(csi, 0, sizeof *csi);
csi->doc = doc;
csi->rdb = rdb;
csi->buf = buf;
csi->cookie = cookie;
}
| 9,532 |
71,093 | 0 | cmsBool WritePositionTable(struct _cms_typehandler_struct* self,
cmsIOHANDLER* io,
cmsUInt32Number SizeOfTag,
cmsUInt32Number Count,
cmsUInt32Number BaseOffset,
void *Cargo,
PositionTableEntryFn ElementFn)
{
cmsUInt32Number i;
cmsUInt32Number DirectoryPos, CurrentPos, Before;
cmsUInt32Number *ElementOffsets = NULL, *ElementSizes = NULL;
ElementOffsets = (cmsUInt32Number *) _cmsCalloc(io ->ContextID, Count, sizeof(cmsUInt32Number));
if (ElementOffsets == NULL) goto Error;
ElementSizes = (cmsUInt32Number *) _cmsCalloc(io ->ContextID, Count, sizeof(cmsUInt32Number));
if (ElementSizes == NULL) goto Error;
DirectoryPos = io ->Tell(io);
for (i=0; i < Count; i++) {
if (!_cmsWriteUInt32Number(io, 0)) goto Error; // Offset
if (!_cmsWriteUInt32Number(io, 0)) goto Error; // size
}
for (i=0; i < Count; i++) {
Before = io ->Tell(io);
ElementOffsets[i] = Before - BaseOffset;
if (!ElementFn(self, io, Cargo, i, SizeOfTag)) goto Error;
ElementSizes[i] = io ->Tell(io) - Before;
}
CurrentPos = io ->Tell(io);
if (!io ->Seek(io, DirectoryPos)) goto Error;
for (i=0; i < Count; i++) {
if (!_cmsWriteUInt32Number(io, ElementOffsets[i])) goto Error;
if (!_cmsWriteUInt32Number(io, ElementSizes[i])) goto Error;
}
if (!io ->Seek(io, CurrentPos)) goto Error;
if (ElementOffsets != NULL) _cmsFree(io ->ContextID, ElementOffsets);
if (ElementSizes != NULL) _cmsFree(io ->ContextID, ElementSizes);
return TRUE;
Error:
if (ElementOffsets != NULL) _cmsFree(io ->ContextID, ElementOffsets);
if (ElementSizes != NULL) _cmsFree(io ->ContextID, ElementSizes);
return FALSE;
}
| 9,533 |
39,566 | 0 | BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s)
{
BYTE MacData[16];
UINT32 ConnectFlags = 0;
DEBUG_LICENSE("Receiving Platform Challenge Packet");
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
Stream_Read_UINT32(s, ConnectFlags); /* ConnectFlags, Reserved (4 bytes) */
/* EncryptedPlatformChallenge */
license->EncryptedPlatformChallenge->type = BB_ANY_BLOB;
license_read_binary_blob(s, license->EncryptedPlatformChallenge);
license->EncryptedPlatformChallenge->type = BB_ENCRYPTED_DATA_BLOB;
if (Stream_GetRemainingLength(s) < 16)
return FALSE;
Stream_Read(s, MacData, 16); /* MACData (16 bytes) */
license_decrypt_platform_challenge(license);
#ifdef WITH_DEBUG_LICENSE
fprintf(stderr, "ConnectFlags: 0x%08X\n", ConnectFlags);
fprintf(stderr, "\n");
fprintf(stderr, "EncryptedPlatformChallenge:\n");
winpr_HexDump(license->EncryptedPlatformChallenge->data, license->EncryptedPlatformChallenge->length);
fprintf(stderr, "\n");
fprintf(stderr, "PlatformChallenge:\n");
winpr_HexDump(license->PlatformChallenge->data, license->PlatformChallenge->length);
fprintf(stderr, "\n");
fprintf(stderr, "MacData:\n");
winpr_HexDump(MacData, 16);
fprintf(stderr, "\n");
#endif
return TRUE;
}
| 9,534 |
181,031 | 1 | print_bacp_config_options(netdissect_options *ndo,
const u_char *p, int length)
{
int len, opt;
if (length < 2)
return 0;
ND_TCHECK2(*p, 2);
len = p[1];
opt = p[0];
if (length < len)
return 0;
if (len < 2) {
ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)",
tok2str(bacconfopts_values, "Unknown", opt),
opt,
len));
return 0;
}
ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u",
tok2str(bacconfopts_values, "Unknown", opt),
opt,
len));
switch (opt) {
case BACPOPT_FPEER:
if (len != 6) {
ND_PRINT((ndo, " (length bogus, should be = 6)"));
return len;
}
ND_TCHECK2(*(p + 2), 4);
ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_32BITS(p + 2)));
break;
default:
/*
* Unknown option; dump it as raw bytes now if we're
* not going to do so below.
*/
if (ndo->ndo_vflag < 2)
print_unknown_data(ndo, &p[2], "\n\t ", len - 2);
break;
}
if (ndo->ndo_vflag > 1)
print_unknown_data(ndo, &p[2], "\n\t ", len - 2); /* exclude TLV header */
return len;
trunc:
ND_PRINT((ndo, "[|bacp]"));
return 0;
}
| 9,535 |
137,911 | 0 | void AXLayoutObject::addPopupChildren() {
if (!isHTMLInputElement(getNode()))
return;
if (AXObject* axPopup = toHTMLInputElement(getNode())->popupRootAXObject())
m_children.push_back(axPopup);
}
| 9,536 |
130,556 | 0 | static void TestObjectConstructorGetter(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
v8::Handle<v8::Value> data = info.Data();
ASSERT(data->IsExternal());
V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext());
if (!perContextData)
return;
v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::unwrap(data)));
}
| 9,537 |
86,984 | 0 | static TEE_Result umap_add_region(struct vm_info *vmi, struct vm_region *reg)
{
struct vm_region *r;
struct vm_region *prev_r;
vaddr_t va_range_base;
size_t va_range_size;
vaddr_t va;
core_mmu_get_user_va_range(&va_range_base, &va_range_size);
/* Check alignment, it has to be at least SMALL_PAGE based */
if ((reg->va | reg->size) & SMALL_PAGE_MASK)
return TEE_ERROR_ACCESS_CONFLICT;
/* Check that the mobj is defined for the entire range */
if ((reg->offset + reg->size) >
ROUNDUP(reg->mobj->size, SMALL_PAGE_SIZE))
return TEE_ERROR_BAD_PARAMETERS;
prev_r = NULL;
TAILQ_FOREACH(r, &vmi->regions, link) {
if (TAILQ_FIRST(&vmi->regions) == r) {
va = select_va_in_range(va_range_base, 0,
r->va, r->attr, reg);
if (va) {
reg->va = va;
TAILQ_INSERT_HEAD(&vmi->regions, reg, link);
return TEE_SUCCESS;
}
} else {
va = select_va_in_range(prev_r->va + prev_r->size,
prev_r->attr, r->va, r->attr,
reg);
if (va) {
reg->va = va;
TAILQ_INSERT_BEFORE(r, reg, link);
return TEE_SUCCESS;
}
}
prev_r = r;
}
r = TAILQ_LAST(&vmi->regions, vm_region_head);
if (r) {
va = select_va_in_range(r->va + r->size, r->attr,
va_range_base + va_range_size, 0, reg);
if (va) {
reg->va = va;
TAILQ_INSERT_TAIL(&vmi->regions, reg, link);
return TEE_SUCCESS;
}
} else {
va = select_va_in_range(va_range_base, 0,
va_range_base + va_range_size, 0, reg);
if (va) {
reg->va = va;
TAILQ_INSERT_HEAD(&vmi->regions, reg, link);
return TEE_SUCCESS;
}
}
return TEE_ERROR_ACCESS_CONFLICT;
}
| 9,538 |
31,260 | 0 | int crypto_hash_walk_first(struct ahash_request *req,
struct crypto_hash_walk *walk)
{
walk->total = req->nbytes;
if (!walk->total)
return 0;
walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req));
walk->sg = req->src;
walk->flags = req->base.flags;
return hash_walk_new_entry(walk);
}
| 9,539 |
128,196 | 0 | String Notification::lang() const
{
return m_data.lang;
}
| 9,540 |
186,348 | 1 | void ResourcePrefetchPredictor::LearnOrigins(
const std::string& host,
const GURL& main_frame_origin,
const std::map<GURL, OriginRequestSummary>& summaries) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (host.size() > ResourcePrefetchPredictorTables::kMaxStringLength)
return;
OriginData data;
bool exists = origin_data_->TryGetData(host, &data);
if (!exists) {
data.set_host(host);
data.set_last_visit_time(base::Time::Now().ToInternalValue());
size_t origins_size = summaries.size();
auto ordered_origins =
std::vector<const OriginRequestSummary*>(origins_size);
for (const auto& kv : summaries) {
size_t index = kv.second.first_occurrence;
DCHECK_LT(index, origins_size);
ordered_origins[index] = &kv.second;
}
for (const OriginRequestSummary* summary : ordered_origins) {
auto* origin_to_add = data.add_origins();
InitializeOriginStatFromOriginRequestSummary(origin_to_add, *summary);
}
} else {
data.set_last_visit_time(base::Time::Now().ToInternalValue());
std::map<GURL, int> old_index;
int old_size = static_cast<int>(data.origins_size());
for (int i = 0; i < old_size; ++i) {
bool is_new =
old_index.insert({GURL(data.origins(i).origin()), i}).second;
DCHECK(is_new);
}
// Update the old origins.
for (int i = 0; i < old_size; ++i) {
auto* old_origin = data.mutable_origins(i);
GURL origin(old_origin->origin());
auto it = summaries.find(origin);
if (it == summaries.end()) {
// miss
old_origin->set_number_of_misses(old_origin->number_of_misses() + 1);
old_origin->set_consecutive_misses(old_origin->consecutive_misses() +
1);
} else {
// hit: update.
const auto& new_origin = it->second;
old_origin->set_always_access_network(new_origin.always_access_network);
old_origin->set_accessed_network(new_origin.accessed_network);
int position = new_origin.first_occurrence + 1;
int total =
old_origin->number_of_hits() + old_origin->number_of_misses();
old_origin->set_average_position(
((old_origin->average_position() * total) + position) /
(total + 1));
old_origin->set_number_of_hits(old_origin->number_of_hits() + 1);
old_origin->set_consecutive_misses(0);
}
}
// Add new origins.
for (const auto& kv : summaries) {
if (old_index.find(kv.first) != old_index.end())
continue;
auto* origin_to_add = data.add_origins();
InitializeOriginStatFromOriginRequestSummary(origin_to_add, kv.second);
}
}
// Trim and Sort.
ResourcePrefetchPredictorTables::TrimOrigins(&data,
config_.max_consecutive_misses);
ResourcePrefetchPredictorTables::SortOrigins(&data, main_frame_origin.spec());
if (data.origins_size() > static_cast<int>(config_.max_origins_per_entry)) {
data.mutable_origins()->DeleteSubrange(
config_.max_origins_per_entry,
data.origins_size() - config_.max_origins_per_entry);
}
// Update the database.
if (data.origins_size() == 0)
origin_data_->DeleteData({host});
else
origin_data_->UpdateData(host, data);
}
| 9,541 |
47,078 | 0 | static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
twofish_enc_blk(crypto_tfm_ctx(tfm), dst, src);
}
| 9,542 |
28,410 | 0 | void fib6_force_start_gc(struct net *net)
{
if (!timer_pending(&net->ipv6.ip6_fib_timer))
mod_timer(&net->ipv6.ip6_fib_timer,
jiffies + net->ipv6.sysctl.ip6_rt_gc_interval);
}
| 9,543 |
125,181 | 0 | void RenderMessageFilter::AsyncOpenFileOnFileThread(const FilePath& path,
int flags,
int message_id,
int routing_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
base::PlatformFile file = base::CreatePlatformFile(
path, flags, NULL, &error_code);
IPC::PlatformFileForTransit file_for_transit =
file != base::kInvalidPlatformFileValue ?
IPC::GetFileHandleForProcess(file, peer_handle(), true) :
IPC::InvalidPlatformFileForTransit();
IPC::Message* reply = new ViewMsg_AsyncOpenFile_ACK(
routing_id, error_code, file_for_transit, message_id);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(base::IgnoreResult(&RenderMessageFilter::Send), this, reply));
}
| 9,544 |
27,481 | 0 | static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
{
if (INET_ECN_is_ce(iph->tos)) {
if (skb->protocol == htons(ETH_P_IP)) {
IP_ECN_set_ce(ip_hdr(skb));
} else if (skb->protocol == htons(ETH_P_IPV6)) {
IP6_ECN_set_ce(ipv6_hdr(skb));
}
}
}
| 9,545 |
160,396 | 0 | void NormalPage::removeFromHeap() {
arenaForNormalPage()->freePage(this);
}
| 9,546 |
65,708 | 0 | test_deny(u32 deny, struct nfs4_ol_stateid *stp)
{
unsigned char mask = 1 << deny;
return (bool)(stp->st_deny_bmap & mask);
}
| 9,547 |
78,162 | 0 | static int asepcos_init(sc_card_t *card)
{
unsigned long flags;
card->name = "Athena ASEPCOS";
card->cla = 0x00;
/* in case of a Java card try to select the ASEPCOS applet */
if (card->type == SC_CARD_TYPE_ASEPCOS_JAVA) {
int r = asepcos_select_asepcos_applet(card);
if (r != SC_SUCCESS)
return SC_ERROR_INVALID_CARD;
}
/* Set up algorithm info. */
flags = SC_ALGORITHM_RSA_RAW
| SC_ALGORITHM_RSA_HASH_NONE
| SC_ALGORITHM_ONBOARD_KEY_GEN
;
_sc_card_add_rsa_alg(card, 512, flags, 0);
_sc_card_add_rsa_alg(card, 768, flags, 0);
_sc_card_add_rsa_alg(card, 1024, flags, 0);
_sc_card_add_rsa_alg(card, 1536, flags, 0);
_sc_card_add_rsa_alg(card, 1792, flags, 0);
_sc_card_add_rsa_alg(card, 2048, flags, 0);
card->caps |= SC_CARD_CAP_APDU_EXT | SC_CARD_CAP_USE_FCI_AC;
return SC_SUCCESS;
}
| 9,548 |
1,525 | 0 | push_callout(i_ctx_t *i_ctx_p, const char *callout_name)
{
int code;
check_estack(1);
code = name_enter_string(imemory, callout_name, esp + 1);
if (code < 0)
return code;
++esp;
r_set_attrs(esp, a_executable);
return o_push_estack;
}
| 9,549 |
4,831 | 0 | FindChildForEvent(SpritePtr pSprite, WindowPtr event)
{
WindowPtr w = DeepestSpriteWin(pSprite);
Window child = None;
/* If the search ends up past the root should the child field be
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
this function with child == None anyway. */
while (w) {
/* If the source window is same as event window, child should be
none. Don't bother going all all the way back to the root. */
if (w == event) {
child = None;
break;
}
if (w->parent == event) {
child = w->drawable.id;
break;
}
w = w->parent;
}
return child;
}
| 9,550 |
47,390 | 0 | static int tgr192_final(struct shash_desc *desc, u8 * out)
{
struct tgr192_ctx *tctx = shash_desc_ctx(desc);
__be64 *dst = (__be64 *)out;
__be64 *be64p;
__le32 *le32p;
u32 t, msb, lsb;
tgr192_update(desc, NULL, 0); /* flush */ ;
msb = 0;
t = tctx->nblocks;
if ((lsb = t << 6) < t) { /* multiply by 64 to make a byte count */
msb++;
}
msb += t >> 26;
t = lsb;
if ((lsb = t + tctx->count) < t) { /* add the count */
msb++;
}
t = lsb;
if ((lsb = t << 3) < t) { /* multiply by 8 to make a bit count */
msb++;
}
msb += t >> 29;
if (tctx->count < 56) { /* enough room */
tctx->hash[tctx->count++] = 0x01; /* pad */
while (tctx->count < 56) {
tctx->hash[tctx->count++] = 0; /* pad */
}
} else { /* need one extra block */
tctx->hash[tctx->count++] = 0x01; /* pad character */
while (tctx->count < 64) {
tctx->hash[tctx->count++] = 0;
}
tgr192_update(desc, NULL, 0); /* flush */ ;
memset(tctx->hash, 0, 56); /* fill next block with zeroes */
}
/* append the 64 bit count */
le32p = (__le32 *)&tctx->hash[56];
le32p[0] = cpu_to_le32(lsb);
le32p[1] = cpu_to_le32(msb);
tgr192_transform(tctx, tctx->hash);
be64p = (__be64 *)tctx->hash;
dst[0] = be64p[0] = cpu_to_be64(tctx->a);
dst[1] = be64p[1] = cpu_to_be64(tctx->b);
dst[2] = be64p[2] = cpu_to_be64(tctx->c);
return 0;
}
| 9,551 |
90,967 | 0 | void CWebServer::Cmd_AddSceneCode(WebEmSession & session, const request& req, Json::Value &root)
{
if (session.rights != 2)
{
session.reply_status = reply::forbidden;
return; //Only admin user allowed
}
std::string sceneidx = request::findValue(&req, "sceneidx");
std::string idx = request::findValue(&req, "idx");
std::string cmnd = request::findValue(&req, "cmnd");
if (
(sceneidx.empty()) ||
(idx.empty()) ||
(cmnd.empty())
)
return;
root["status"] = "OK";
root["title"] = "AddSceneCode";
std::vector<std::vector<std::string> > result;
result = m_sql.safe_query("SELECT Activators, SceneType FROM Scenes WHERE (ID==%q)", sceneidx.c_str());
if (result.empty())
return;
std::string Activators = result[0][0];
unsigned char scenetype = atoi(result[0][1].c_str());
if (!Activators.empty())
{
std::vector<std::string> arrayActivators;
StringSplit(Activators, ";", arrayActivators);
for (const auto & ittAct : arrayActivators)
{
std::string sCodeCmd = ittAct;
std::vector<std::string> arrayCode;
StringSplit(sCodeCmd, ":", arrayCode);
std::string sID = arrayCode[0];
std::string sCode = "";
if (arrayCode.size() == 2)
{
sCode = arrayCode[1];
}
if (sID == idx)
{
if (scenetype == 1)
return; //Group does not work with separate codes, so already there
if (sCode == cmnd)
return; //same code, already there!
}
}
}
if (!Activators.empty())
Activators += ";";
Activators += idx;
if (scenetype == 0)
{
Activators += ":" + cmnd;
}
m_sql.safe_query("UPDATE Scenes SET Activators='%q' WHERE (ID==%q)", Activators.c_str(), sceneidx.c_str());
}
| 9,552 |
169,273 | 0 | MockOverscrollControllerImpl()
: content_scrolling_(false),
message_loop_runner_(new MessageLoopRunner) {}
| 9,553 |
58,552 | 0 | void transport_attach(rdpTransport* transport, int sockfd)
{
transport->TcpIn->sockfd = sockfd;
transport->SplitInputOutput = FALSE;
transport->TcpOut = transport->TcpIn;
}
| 9,554 |
138,902 | 0 | void WallpaperManager::RemoveUserWallpaperInfo(const AccountId& account_id) {
if (wallpaper_cache_.find(account_id) != wallpaper_cache_.end())
wallpaper_cache_.erase(account_id);
PrefService* prefs = g_browser_process->local_state();
if (!prefs)
return;
WallpaperInfo info;
GetUserWallpaperInfo(account_id, &info);
DictionaryPrefUpdate prefs_wallpapers_info_update(
prefs, wallpaper::kUsersWallpaperInfo);
prefs_wallpapers_info_update->RemoveWithoutPathExpansion(
account_id.GetUserEmail(), NULL);
DictionaryPrefUpdate wallpaper_colors_update(prefs,
ash::prefs::kWallpaperColors);
wallpaper_colors_update->RemoveWithoutPathExpansion(info.location, nullptr);
DeleteUserWallpapers(account_id, info.location);
}
| 9,555 |
59,852 | 0 | static unsigned get_maxpacket(struct usb_device *udev, int pipe)
{
struct usb_host_endpoint *ep;
ep = usb_pipe_endpoint(udev, pipe);
return le16_to_cpup(&ep->desc.wMaxPacketSize);
}
| 9,556 |
23,997 | 0 | static void airo_set_promisc(struct airo_info *ai) {
Cmd cmd;
Resp rsp;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd=CMD_SETMODE;
clear_bit(JOB_PROMISC, &ai->jobs);
cmd.parm0=(ai->flags&IFF_PROMISC) ? PROMISC : NOPROMISC;
issuecommand(ai, &cmd, &rsp);
up(&ai->sem);
}
| 9,557 |
35,307 | 0 | static struct softnet_data *softnet_get_online(loff_t *pos)
{
struct softnet_data *sd = NULL;
while (*pos < nr_cpu_ids)
if (cpu_online(*pos)) {
sd = &per_cpu(softnet_data, *pos);
break;
} else
++*pos;
return sd;
}
| 9,558 |
183,891 | 1 | PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionCode& ec)
{
if (!m_start.container()) {
ec = INVALID_STATE_ERR;
return 0;
}
Node* element = m_start.container()->isElementNode() ? m_start.container() : m_start.container()->parentNode();
if (!element || !element->isHTMLElement()) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
RefPtr<DocumentFragment> fragment = createDocumentFragmentForElement(markup, toElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted);
if (!fragment) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
return fragment.release();
}
| 9,559 |
14,990 | 0 | ProcListFonts(ClientPtr client)
{
REQUEST(xListFontsReq);
REQUEST_FIXED_SIZE(xListFontsReq, stuff->nbytes);
return ListFonts(client, (unsigned char *) &stuff[1], stuff->nbytes,
stuff->maxNames);
}
| 9,560 |
157,197 | 0 | unsigned WebMediaPlayerImpl::DroppedFrameCount() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
return GetPipelineStatistics().video_frames_dropped;
}
| 9,561 |
26,201 | 0 | static int swevent_hlist_get(struct perf_event *event)
{
int err;
int cpu, failed_cpu;
if (event->cpu != -1)
return swevent_hlist_get_cpu(event, event->cpu);
get_online_cpus();
for_each_possible_cpu(cpu) {
err = swevent_hlist_get_cpu(event, cpu);
if (err) {
failed_cpu = cpu;
goto fail;
}
}
put_online_cpus();
return 0;
fail:
for_each_possible_cpu(cpu) {
if (cpu == failed_cpu)
break;
swevent_hlist_put_cpu(event, cpu);
}
put_online_cpus();
return err;
}
| 9,562 |
29,706 | 0 | void *av_realloc(void *ptr, size_t size)
{
#if CONFIG_MEMALIGN_HACK
int diff;
#endif
/* let's disallow possible ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
#if CONFIG_MEMALIGN_HACK
if (!ptr)
return av_malloc(size);
diff = ((char *)ptr)[-1];
av_assert0(diff>0 && diff<=ALIGN);
ptr = realloc((char *)ptr - diff, size + diff);
if (ptr)
ptr = (char *)ptr + diff;
return ptr;
#elif HAVE_ALIGNED_MALLOC
return _aligned_realloc(ptr, size + !size, ALIGN);
#else
return realloc(ptr, size + !size);
#endif
}
| 9,563 |
37,107 | 0 | static int init_rmode_identity_map(struct kvm *kvm)
{
int i, idx, r = 0;
pfn_t identity_map_pfn;
u32 tmp;
if (!enable_ept)
return 0;
/* Protect kvm->arch.ept_identity_pagetable_done. */
mutex_lock(&kvm->slots_lock);
if (likely(kvm->arch.ept_identity_pagetable_done))
goto out2;
identity_map_pfn = kvm->arch.ept_identity_map_addr >> PAGE_SHIFT;
r = alloc_identity_pagetable(kvm);
if (r < 0)
goto out2;
idx = srcu_read_lock(&kvm->srcu);
r = kvm_clear_guest_page(kvm, identity_map_pfn, 0, PAGE_SIZE);
if (r < 0)
goto out;
/* Set up identity-mapping pagetable for EPT in real mode */
for (i = 0; i < PT32_ENT_PER_PAGE; i++) {
tmp = (i << 22) + (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER |
_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE);
r = kvm_write_guest_page(kvm, identity_map_pfn,
&tmp, i * sizeof(tmp), sizeof(tmp));
if (r < 0)
goto out;
}
kvm->arch.ept_identity_pagetable_done = true;
out:
srcu_read_unlock(&kvm->srcu, idx);
out2:
mutex_unlock(&kvm->slots_lock);
return r;
}
| 9,564 |
61,358 | 0 | static int asf_read_metadata(AVFormatContext *s, int64_t size)
{
AVIOContext *pb = s->pb;
ASFContext *asf = s->priv_data;
int n, stream_num, name_len_utf16, name_len_utf8, value_len;
int ret, i;
n = avio_rl16(pb);
for (i = 0; i < n; i++) {
uint8_t *name;
int value_type;
avio_rl16(pb); // lang_list_index
stream_num = avio_rl16(pb);
name_len_utf16 = avio_rl16(pb);
value_type = avio_rl16(pb); /* value_type */
value_len = avio_rl32(pb);
name_len_utf8 = 2*name_len_utf16 + 1;
name = av_malloc(name_len_utf8);
if (!name)
return AVERROR(ENOMEM);
if ((ret = avio_get_str16le(pb, name_len_utf16, name, name_len_utf8)) < name_len_utf16)
avio_skip(pb, name_len_utf16 - ret);
av_log(s, AV_LOG_TRACE, "%d stream %d name_len %2d type %d len %4d <%s>\n",
i, stream_num, name_len_utf16, value_type, value_len, name);
if (!strcmp(name, "AspectRatioX")){
int aspect_x = get_value(s->pb, value_type, 16);
if(stream_num < 128)
asf->dar[stream_num].num = aspect_x;
} else if(!strcmp(name, "AspectRatioY")){
int aspect_y = get_value(s->pb, value_type, 16);
if(stream_num < 128)
asf->dar[stream_num].den = aspect_y;
} else {
get_tag(s, name, value_type, value_len, 16);
}
av_freep(&name);
}
return 0;
}
| 9,565 |
58,471 | 0 | traverse_socks (int print_fd, int sok, char *serverAddr, int port)
{
struct sock_connect sc;
unsigned char buf[256];
sc.version = 4;
sc.type = 1;
sc.port = htons (port);
sc.address = inet_addr (serverAddr);
strncpy (sc.username, prefs.hex_irc_user_name, 9);
send (sok, (char *) &sc, 8 + strlen (sc.username) + 1, 0);
buf[1] = 0;
recv (sok, buf, 10, 0);
if (buf[1] == 90)
return 0;
snprintf (buf, sizeof (buf), "SOCKS\tServer reported error %d,%d.\n", buf[0], buf[1]);
proxy_error (print_fd, buf);
return 1;
}
| 9,566 |
112,926 | 0 | void InsertIntoMap(GDataCacheMetadataMap::CacheMap* cache_map,
const std::string& resource_id,
const std::string& md5,
GDataCache::CacheSubDirectoryType sub_dir_type,
int cache_state) {
cache_map->insert(std::make_pair(
resource_id, GDataCache::CacheEntry(md5, sub_dir_type, cache_state)));
}
| 9,567 |
167,377 | 0 | void SetCookieCallback(bool result) {
ASSERT_TRUE(result);
quit_closure_.Run();
}
| 9,568 |
17,724 | 0 | DGAStealButtonEvent(DeviceIntPtr dev, int index, int button, int is_down)
{
DGAScreenPtr pScreenPriv;
DGAEvent event;
if (!DGAScreenKeyRegistered) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
if (!pScreenPriv || !pScreenPriv->grabMouse)
return FALSE;
event = (DGAEvent) {
.header = ET_Internal,
.type = ET_DGAEvent,
.length = sizeof(event),
.time = GetTimeInMillis(),
.subtype = (is_down ? ET_ButtonPress : ET_ButtonRelease),
.detail = button,
.dx = 0,
.dy = 0
};
mieqEnqueue(dev, (InternalEvent *) &event);
return TRUE;
}
| 9,569 |
118,851 | 0 | void WebContentsImpl::DidFailProvisionalLoadWithError(
RenderViewHost* render_view_host,
const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
<< ", error_code: " << params.error_code
<< ", error_description: " << params.error_description
<< ", is_main_frame: " << params.is_main_frame
<< ", showing_repost_interstitial: " <<
params.showing_repost_interstitial
<< ", frame_id: " << params.frame_id;
GURL validated_url(params.url);
RenderProcessHost* render_process_host =
render_view_host->GetProcess();
RenderViewHost::FilterURL(render_process_host, false, &validated_url);
if (net::ERR_ABORTED == params.error_code) {
if (ShowingInterstitialPage()) {
LOG(WARNING) << "Discarding message during interstitial.";
return;
}
render_manager_.RendererAbortedProvisionalLoad(render_view_host);
}
if (controller_.GetPendingEntry() != controller_.GetVisibleEntry())
controller_.DiscardPendingEntry();
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
DidFailProvisionalLoad(params.frame_id,
params.is_main_frame,
validated_url,
params.error_code,
params.error_description,
render_view_host));
}
| 9,570 |
20,089 | 0 | read_eeprom (long ioaddr, int eep_addr)
{
int i = 1000;
outw (EEP_READ | (eep_addr & 0xff), ioaddr + EepromCtrl);
while (i-- > 0) {
if (!(inw (ioaddr + EepromCtrl) & EEP_BUSY)) {
return inw (ioaddr + EepromData);
}
}
return 0;
}
| 9,571 |
7,337 | 0 | string_tolower (char *string)
{
while (string && string[0])
{
if ((string[0] >= 'A') && (string[0] <= 'Z'))
string[0] += ('a' - 'A');
string = utf8_next_char (string);
}
}
| 9,572 |
111,696 | 0 | void EditorClientBlackBerry::handleKeyboardEvent(KeyboardEvent* event)
{
ASSERT(event);
const PlatformKeyboardEvent* platformEvent = event->keyEvent();
if (!platformEvent)
return;
ASSERT(event->target()->toNode());
Frame* frame = event->target()->toNode()->document()->frame();
ASSERT(frame);
String commandName = interpretKeyEvent(event);
ASSERT(!(event->type() == eventNames().keydownEvent && frame->editor()->command(commandName).isTextInsertion()));
if (!commandName.isEmpty()) {
if (commandName != "DeleteBackward")
m_webPagePrivate->m_inputHandler->setProcessingChange(false);
if (frame->editor()->command(commandName).execute())
event->setDefaultHandled();
return;
}
if (!frame->editor()->canEdit())
return;
if (event->type() != eventNames().keypressEvent)
return;
if (event->charCode() < ' ')
return;
if (event->ctrlKey() || event->altKey())
return;
if (!platformEvent->text().isEmpty()) {
if (frame->editor()->insertText(platformEvent->text(), event))
event->setDefaultHandled();
}
}
| 9,573 |
61,413 | 0 | static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
unsigned i, num;
void *new_tracks;
num = atom.size / 4;
if (!(new_tracks = av_malloc_array(num, sizeof(int))))
return AVERROR(ENOMEM);
av_free(c->chapter_tracks);
c->chapter_tracks = new_tracks;
c->nb_chapter_tracks = num;
for (i = 0; i < num && !pb->eof_reached; i++)
c->chapter_tracks[i] = avio_rb32(pb);
return 0;
}
| 9,574 |
161,886 | 0 | void PrintRenderFrameHelper::ComputePageLayoutInPointsForCss(
blink::WebLocalFrame* frame,
int page_index,
const PrintMsg_Print_Params& page_params,
bool ignore_css_margins,
double* scale_factor,
PageSizeMargins* page_layout_in_points) {
double input_scale_factor = *scale_factor;
PrintMsg_Print_Params params = CalculatePrintParamsForCss(
frame, page_index, page_params, ignore_css_margins,
IsWebPrintScalingOptionFitToPage(page_params), scale_factor);
CalculatePageLayoutFromPrintParams(params, input_scale_factor,
page_layout_in_points);
}
| 9,575 |
36,670 | 0 | static void recalloc_sock(struct pool *pool, size_t len)
{
size_t old, new;
old = strlen(pool->sockbuf);
new = old + len + 1;
if (new < pool->sockbuf_size)
return;
new = new + (RBUFSIZE - (new % RBUFSIZE));
pool->sockbuf = realloc(pool->sockbuf, new);
if (!pool->sockbuf)
quithere(1, "Failed to realloc pool sockbuf");
memset(pool->sockbuf + old, 0, new - old);
pool->sockbuf_size = new;
}
| 9,576 |
185,630 | 1 | void Editor::ChangeSelectionAfterCommand(
const SelectionInDOMTree& new_selection,
const SetSelectionData& options) {
if (new_selection.IsNone())
return;
// See <rdar://problem/5729315> Some shouldChangeSelectedDOMRange contain
// Ranges for selections that are no longer valid
bool selection_did_not_change_dom_position =
new_selection == GetFrame().Selection().GetSelectionInDOMTree();
GetFrame().Selection().SetSelection(
SelectionInDOMTree::Builder(new_selection)
.SetIsHandleVisible(GetFrame().Selection().IsHandleVisible())
.Build(),
options);
// Some editing operations change the selection visually without affecting its
// position within the DOM. For example when you press return in the following
// (the caret is marked by ^):
// <div contentEditable="true"><div>^Hello</div></div>
// WebCore inserts <div><br></div> *before* the current block, which correctly
// moves the paragraph down but which doesn't change the caret's DOM position
// (["hello", 0]). In these situations the above FrameSelection::setSelection
// call does not call EditorClient::respondToChangedSelection(), which, on the
// Mac, sends selection change notifications and starts a new kill ring
// sequence, but we want to do these things (matches AppKit).
if (selection_did_not_change_dom_position) {
Client().RespondToChangedSelection(
frame_, GetFrame().Selection().GetSelectionInDOMTree().Type());
}
}
| 9,577 |
153,920 | 0 | std::unique_ptr<AbstractTexture> GLES2DecoderImpl::CreateAbstractTexture(
GLenum target,
GLenum internal_format,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border,
GLenum format,
GLenum type) {
GLuint service_id = 0;
api()->glGenTexturesFn(1, &service_id);
scoped_refptr<gpu::gles2::TextureRef> texture_ref =
TextureRef::Create(texture_manager(), 0, service_id);
texture_manager()->SetTarget(texture_ref.get(), target);
const GLint level = 0;
gfx::Rect cleared_rect = gfx::Rect();
texture_manager()->SetLevelInfo(texture_ref.get(), target, level,
internal_format, width, height, depth, border,
format, type, cleared_rect);
std::unique_ptr<ValidatingAbstractTextureImpl> abstract_texture =
std::make_unique<ValidatingAbstractTextureImpl>(
std::move(texture_ref), this,
base::BindOnce(&GLES2DecoderImpl::OnAbstractTextureDestroyed,
base::Unretained(this)));
abstract_textures_.insert(abstract_texture.get());
return abstract_texture;
}
| 9,578 |
34,265 | 0 | static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags)
{
struct extent_io_tree *tree;
struct extent_map_tree *map;
int ret;
tree = &BTRFS_I(page->mapping->host)->io_tree;
map = &BTRFS_I(page->mapping->host)->extent_tree;
ret = try_release_extent_mapping(map, tree, page, gfp_flags);
if (ret == 1) {
ClearPagePrivate(page);
set_page_private(page, 0);
page_cache_release(page);
}
return ret;
}
| 9,579 |
130,562 | 0 | static void XMLObjAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_VOID(TestObject*, cppValue, V8TestObject::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
imp->setXMLObjAttr(WTF::getPtr(cppValue));
}
| 9,580 |
8,467 | 0 | void CSoundFile::CheckCPUUsage(UINT nCPU)
{
if (nCPU > 100) nCPU = 100;
gnCPUUsage = nCPU;
if (nCPU < 90)
{
m_dwSongFlags &= ~SONG_CPUVERYHIGH;
} else
if ((m_dwSongFlags & SONG_CPUVERYHIGH) && (nCPU >= 94))
{
UINT i=MAX_CHANNELS;
while (i >= 8)
{
i--;
if (Chn[i].nLength)
{
Chn[i].nLength = Chn[i].nPos = 0;
nCPU -= 2;
if (nCPU < 94) break;
}
}
} else
if (nCPU > 90)
{
m_dwSongFlags |= SONG_CPUVERYHIGH;
}
}
| 9,581 |
165,016 | 0 | bool HTMLCanvasElement::IsWebGL1Enabled() const {
Document& document = GetDocument();
LocalFrame* frame = document.GetFrame();
if (!frame)
return false;
Settings* settings = frame->GetSettings();
return settings && settings->GetWebGL1Enabled();
}
| 9,582 |
30,517 | 0 | static void nr_insert_socket(struct sock *sk)
{
spin_lock_bh(&nr_list_lock);
sk_add_node(sk, &nr_list);
spin_unlock_bh(&nr_list_lock);
}
| 9,583 |
74,963 | 0 | static UINT drdynvc_virtual_channel_event_detached(drdynvcPlugin* drdynvc)
{
int i;
DVCMAN* dvcman;
if (!drdynvc)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
dvcman = (DVCMAN*) drdynvc->channel_mgr;
if (!dvcman)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
for (i = 0; i < dvcman->num_plugins; i++)
{
UINT error;
IWTSPlugin* pPlugin = dvcman->plugins[i];
if (pPlugin->Detached)
if ((error = pPlugin->Detached(pPlugin)))
{
WLog_Print(drdynvc->log, WLOG_ERROR, "Detach failed with error %"PRIu32"!", error);
return error;
}
}
return CHANNEL_RC_OK;
}
| 9,584 |
56,004 | 0 | static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
{
struct tty_ldisc *new_ldisc;
int r;
/* There is an outstanding reference here so this is safe */
old = tty_ldisc_get(tty, old->ops->num);
WARN_ON(IS_ERR(old));
tty->ldisc = old;
tty_set_termios_ldisc(tty, old->ops->num);
if (tty_ldisc_open(tty, old) < 0) {
tty_ldisc_put(old);
/* This driver is always present */
new_ldisc = tty_ldisc_get(tty, N_TTY);
if (IS_ERR(new_ldisc))
panic("n_tty: get");
tty->ldisc = new_ldisc;
tty_set_termios_ldisc(tty, N_TTY);
r = tty_ldisc_open(tty, new_ldisc);
if (r < 0)
panic("Couldn't open N_TTY ldisc for "
"%s --- error %d.",
tty_name(tty), r);
}
}
| 9,585 |
152,737 | 0 | bool Histogram::InspectConstructionArguments(const std::string& name,
Sample* minimum,
Sample* maximum,
uint32_t* bucket_count) {
if (*minimum < 1) {
DVLOG(1) << "Histogram: " << name << " has bad minimum: " << *minimum;
*minimum = 1;
}
if (*maximum >= kSampleType_MAX) {
DVLOG(1) << "Histogram: " << name << " has bad maximum: " << *maximum;
*maximum = kSampleType_MAX - 1;
}
if (*bucket_count >= kBucketCount_MAX) {
DVLOG(1) << "Histogram: " << name << " has bad bucket_count: "
<< *bucket_count;
*bucket_count = kBucketCount_MAX - 1;
}
if (*minimum >= *maximum)
return false;
if (*bucket_count < 3)
return false;
if (*bucket_count > static_cast<uint32_t>(*maximum - *minimum + 2))
return false;
return true;
}
| 9,586 |
159,291 | 0 | static void CreateContextProviderOnMainThread(
ContextProviderCreationInfo* creation_info,
WaitableEvent* waitable_event) {
DCHECK(IsMainThread());
*creation_info->using_gpu_compositing =
!Platform::Current()->IsGpuCompositingDisabled();
creation_info->created_context_provider =
Platform::Current()->CreateOffscreenGraphicsContext3DProvider(
creation_info->context_attributes, creation_info->url, nullptr,
creation_info->gl_info);
waitable_event->Signal();
}
| 9,587 |
149,098 | 0 | static int collationMatch(const char *zColl, Index *pIndex){
int i;
assert( zColl!=0 );
for(i=0; i<pIndex->nColumn; i++){
const char *z = pIndex->azColl[i];
assert( z!=0 || pIndex->aiColumn[i]<0 );
if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
return 1;
}
}
return 0;
}
| 9,588 |
59,234 | 0 | get_pa_etype_info2(krb5_context context,
krb5_kdc_configuration *config,
METHOD_DATA *md, Key *ckey)
{
krb5_error_code ret = 0;
ETYPE_INFO2 pa;
unsigned char *buf;
size_t len;
pa.len = 1;
pa.val = calloc(1, sizeof(pa.val[0]));
if(pa.val == NULL)
return ENOMEM;
ret = make_etype_info2_entry(&pa.val[0], ckey);
if (ret) {
free_ETYPE_INFO2(&pa);
return ret;
}
ASN1_MALLOC_ENCODE(ETYPE_INFO2, buf, len, &pa, &len, ret);
free_ETYPE_INFO2(&pa);
if(ret)
return ret;
ret = realloc_method_data(md);
if(ret) {
free(buf);
return ret;
}
md->val[md->len - 1].padata_type = KRB5_PADATA_ETYPE_INFO2;
md->val[md->len - 1].padata_value.length = len;
md->val[md->len - 1].padata_value.data = buf;
return 0;
}
| 9,589 |
80,967 | 0 | static inline bool is_icebp(u32 intr_info)
{
return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
== (INTR_TYPE_PRIV_SW_EXCEPTION | INTR_INFO_VALID_MASK);
}
| 9,590 |
185,960 | 1 | void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {
PaintLayerCompositor* compositor = GetLayoutBox()->View()->Compositor();
if (!compositor->InCompositingMode())
return;
if (UsesCompositedScrolling()) {
DCHECK(Layer()->HasCompositedLayerMapping());
ScrollingCoordinator* scrolling_coordinator = GetScrollingCoordinator();
bool handled_scroll =
Layer()->IsRootLayer() && scrolling_coordinator &&
scrolling_coordinator->UpdateCompositedScrollOffset(this);
if (!handled_scroll) {
if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
// In non-BGPT mode, we need to do a full sub-tree update here, because
// we need to update the position property to compute
// offset_to_transform_parent. For more context, see the comment from
// chrishtr@ here:
// https://chromium-review.googlesource.com/c/chromium/src/+/1403639/6/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
Layer()->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(
kGraphicsLayerUpdateSubtree);
}
compositor->SetNeedsCompositingUpdate(
kCompositingUpdateAfterGeometryChange);
}
// If we have fixed elements and we scroll the root layer we might
// change compositing since the fixed elements might now overlap a
// composited layer.
if (Layer()->IsRootLayer()) {
LocalFrame* frame = GetLayoutBox()->GetFrame();
if (frame && frame->View() &&
frame->View()->HasViewportConstrainedObjects()) {
Layer()->SetNeedsCompositingInputsUpdate();
}
}
} else {
Layer()->SetNeedsCompositingInputsUpdate();
}
}
| 9,591 |
172,014 | 0 | static void btsock_l2cap_cbk(tBTA_JV_EVT event, tBTA_JV *p_data, void *user_data)
{
int rc;
switch (event) {
case BTA_JV_L2CAP_START_EVT:
on_srv_l2cap_listen_started(&p_data->l2c_start, (uint32_t)user_data);
break;
case BTA_JV_L2CAP_CL_INIT_EVT:
on_cl_l2cap_init(&p_data->l2c_cl_init, (uint32_t)user_data);
break;
case BTA_JV_L2CAP_OPEN_EVT:
on_l2cap_connect(p_data, (uint32_t)user_data);
BTA_JvSetPmProfile(p_data->l2c_open.handle,BTA_JV_PM_ID_1,BTA_JV_CONN_OPEN);
break;
case BTA_JV_L2CAP_CLOSE_EVT:
APPL_TRACE_DEBUG("BTA_JV_L2CAP_CLOSE_EVT: user_data:%d", (uint32_t)user_data);
on_l2cap_close(&p_data->l2c_close, (uint32_t)user_data);
break;
case BTA_JV_L2CAP_DATA_IND_EVT:
on_l2cap_data_ind(p_data, (uint32_t)user_data);
APPL_TRACE_DEBUG("BTA_JV_L2CAP_DATA_IND_EVT");
break;
case BTA_JV_L2CAP_READ_EVT:
APPL_TRACE_DEBUG("BTA_JV_L2CAP_READ_EVT not used");
break;
case BTA_JV_L2CAP_RECEIVE_EVT:
APPL_TRACE_DEBUG("BTA_JV_L2CAP_RECEIVE_EVT not used");
break;
case BTA_JV_L2CAP_WRITE_EVT:
APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_EVT id: %d", (int)user_data);
on_l2cap_write_done((void*)p_data->l2c_write.req_id, (uint32_t)user_data);
break;
case BTA_JV_L2CAP_WRITE_FIXED_EVT:
APPL_TRACE_DEBUG("BTA_JV_L2CAP_WRITE_FIXED_EVT id: %d", (int)user_data);
on_l2cap_write_fixed_done((void*)p_data->l2c_write_fixed.req_id, (uint32_t)user_data);
break;
case BTA_JV_L2CAP_CONG_EVT:
on_l2cap_outgoing_congest(&p_data->l2c_cong, (uint32_t)user_data);
break;
default:
APPL_TRACE_ERROR("unhandled event %d, slot id:%d", event, (uint32_t)user_data);
break;
}
}
| 9,592 |
114,170 | 0 | string16 ChromeContentClient::GetLocalizedString(int message_id) const {
return l10n_util::GetStringUTF16(message_id);
}
| 9,593 |
142,230 | 0 | void FileManagerBrowserTestBase::StartTest() {
LOG(INFO) << "FileManagerBrowserTest::StartTest " << GetFullTestCaseName();
static const base::FilePath test_extension_dir =
base::FilePath(FILE_PATH_LITERAL("ui/file_manager/integration_tests"));
LaunchExtension(test_extension_dir, GetTestExtensionManifestName());
RunTestMessageLoop();
}
| 9,594 |
172,720 | 0 | status_t MediaRecorder::setVideoSource(int vs)
{
ALOGV("setVideoSource(%d)", vs);
if (mMediaRecorder == NULL) {
ALOGE("media recorder is not initialized yet");
return INVALID_OPERATION;
}
if (mIsVideoSourceSet) {
ALOGE("video source has already been set");
return INVALID_OPERATION;
}
if (mCurrentState & MEDIA_RECORDER_IDLE) {
ALOGV("Call init() since the media recorder is not initialized yet");
status_t ret = init();
if (OK != ret) {
return ret;
}
}
if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) {
ALOGE("setVideoSource called in an invalid state(%d)", mCurrentState);
return INVALID_OPERATION;
}
status_t ret = mMediaRecorder->setVideoSource(vs);
if (OK != ret) {
ALOGV("setVideoSource failed: %d", ret);
mCurrentState = MEDIA_RECORDER_ERROR;
return ret;
}
mIsVideoSourceSet = true;
return ret;
}
| 9,595 |
60,125 | 0 | static RBinFile *r_bin_file_find_by_id(RBin *bin, ut32 binfile_id) {
RBinFile *binfile = NULL;
RListIter *iter = NULL;
r_list_foreach (bin->binfiles, iter, binfile) {
if (binfile->id == binfile_id) {
break;
}
binfile = NULL;
}
return binfile;
}
| 9,596 |
163,197 | 0 | void NavigationControllerImpl::GoToIndex(int index) {
TRACE_EVENT0("browser,navigation,benchmark",
"NavigationControllerImpl::GoToIndex");
if (index < 0 || index >= static_cast<int>(entries_.size())) {
NOTREACHED();
return;
}
if (transient_entry_index_ != -1) {
if (index == transient_entry_index_) {
return;
}
if (index > transient_entry_index_) {
index--;
}
}
DiscardNonCommittedEntries();
DCHECK_EQ(nullptr, pending_entry_);
DCHECK_EQ(-1, pending_entry_index_);
pending_entry_ = entries_[index].get();
pending_entry_index_ = index;
pending_entry_->SetTransitionType(ui::PageTransitionFromInt(
pending_entry_->GetTransitionType() | ui::PAGE_TRANSITION_FORWARD_BACK));
NavigateToPendingEntry(ReloadType::NONE);
}
| 9,597 |
104,578 | 0 | virtual void TearDown() {
loop_.RunAllPending();
service_.reset();
}
| 9,598 |
176,147 | 0 | bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) {
return (actionCode == ACTION_CODE_RECOVERABLE);
}
| 9,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.