unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
147,688 | 0 | void V8TestObject::PerWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_perWorldBindingsReadonlyTestInterfaceEmptyAttribute_Getter");
test_object_v8_internal::PerWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetter(info);
}
| 17,900 |
20,368 | 0 | static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
struct mm_struct *mm,
unsigned long address,
pte_t pte)
{
struct kvm *kvm = mmu_notifier_to_kvm(mn);
int idx;
idx = srcu_read_lock(&kvm->srcu);
spin_lock(&kvm->mmu_lock);
kvm->mmu_notifier_seq++;
kvm_set_spte_hva(kvm, address, pte);
spin_unlock(&kvm->mmu_lock);
srcu_read_unlock(&kvm->srcu, idx);
}
| 17,901 |
150,025 | 0 | void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
ScrollStateData scroll_state_data;
ScrollState scroll_state(scroll_state_data);
ScrollEnd(&scroll_state);
}
| 17,902 |
35,977 | 0 | SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
{
struct smb2_logoff_req *req; /* response is also trivial struct */
int rc = 0;
struct TCP_Server_Info *server;
cifs_dbg(FYI, "disconnect session %p\n", ses);
if (ses && (ses->server))
server = ses->server;
else
return -EIO;
/* no need to send SMB logoff if uid already closed due to reconnect */
if (ses->need_reconnect)
goto smb2_session_already_dead;
rc = small_smb2_init(SMB2_LOGOFF, NULL, (void **) &req);
if (rc)
return rc;
/* since no tcon, smb2_init can not do this, so do here */
req->hdr.SessionId = ses->Suid;
if (server->sign)
req->hdr.Flags |= SMB2_FLAGS_SIGNED;
rc = SendReceiveNoRsp(xid, ses, (char *) &req->hdr, 0);
/*
* No tcon so can't do
* cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
*/
smb2_session_already_dead:
return rc;
}
| 17,903 |
97,641 | 0 | xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) {
unsigned char c;
unsigned int val;
const xmlChar *cur;
if (ctxt == NULL)
return(0);
cur = ctxt->cur;
/*
* We are supposed to handle UTF8, check it's valid
* From rfc2044: encoding of the Unicode values on UTF-8:
*
* UCS-4 range (hex.) UTF-8 octet sequence (binary)
* 0000 0000-0000 007F 0xxxxxxx
* 0000 0080-0000 07FF 110xxxxx 10xxxxxx
* 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
*
* Check for the 0x110000 limit too
*/
c = *cur;
if (c & 0x80) {
if ((cur[1] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xe0) == 0xe0) {
if ((cur[2] & 0xc0) != 0x80)
goto encoding_error;
if ((c & 0xf0) == 0xf0) {
if (((c & 0xf8) != 0xf0) ||
((cur[3] & 0xc0) != 0x80))
goto encoding_error;
/* 4-byte code */
*len = 4;
val = (cur[0] & 0x7) << 18;
val |= (cur[1] & 0x3f) << 12;
val |= (cur[2] & 0x3f) << 6;
val |= cur[3] & 0x3f;
} else {
/* 3-byte code */
*len = 3;
val = (cur[0] & 0xf) << 12;
val |= (cur[1] & 0x3f) << 6;
val |= cur[2] & 0x3f;
}
} else {
/* 2-byte code */
*len = 2;
val = (cur[0] & 0x1f) << 6;
val |= cur[1] & 0x3f;
}
if (!IS_CHAR(val)) {
XP_ERROR0(XPATH_INVALID_CHAR_ERROR);
}
return(val);
} else {
/* 1-byte code */
*len = 1;
return((int) *cur);
}
encoding_error:
/*
* If we detect an UTF8 error that probably means that the
* input encoding didn't get properly advertised in the
* declaration header. Report the error and switch the encoding
* to ISO-Latin-1 (if you don't like this policy, just declare the
* encoding !)
*/
*len = 0;
XP_ERROR0(XPATH_ENCODING_ERROR);
}
| 17,904 |
120,771 | 0 | std::string BluetoothAdapterChromeOS::GetName() const {
if (!IsPresent())
return std::string();
BluetoothAdapterClient::Properties* properties =
DBusThreadManager::Get()->GetBluetoothAdapterClient()->
GetProperties(object_path_);
DCHECK(properties);
return properties->alias.value();
}
| 17,905 |
186,411 | 1 | void BluetoothDeviceChooserController::GetDevice(
blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
const SuccessCallback& success_callback,
const ErrorCallback& error_callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// GetDevice should only be called once.
DCHECK(success_callback_.is_null());
DCHECK(error_callback_.is_null());
success_callback_ = success_callback;
error_callback_ = error_callback;
options_ = std::move(options);
LogRequestDeviceOptions(options_);
// Check blocklist to reject invalid filters and adjust optional_services.
if (options_->filters &&
BluetoothBlocklist::Get().IsExcluded(options_->filters.value())) {
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLOCKLISTED_SERVICE_IN_FILTER);
PostErrorCallback(
blink::mojom::WebBluetoothResult::REQUEST_DEVICE_WITH_BLOCKLISTED_UUID);
return;
}
BluetoothBlocklist::Get().RemoveExcludedUUIDs(options_.get());
const url::Origin requesting_origin =
render_frame_host_->GetLastCommittedOrigin();
const url::Origin embedding_origin =
web_contents_->GetMainFrame()->GetLastCommittedOrigin();
// TODO(crbug.com/518042): Enforce correctly-delegated permissions instead of
// matching origins. When relaxing this, take care to handle non-sandboxed
// unique origins.
if (!embedding_origin.IsSameOriginWith(requesting_origin)) {
PostErrorCallback(blink::mojom::WebBluetoothResult::
REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME);
return;
}
// The above also excludes opaque origins, which are not even same-origin with
// themselves.
DCHECK(!requesting_origin.opaque());
if (!adapter_->IsPresent()) {
DVLOG(1) << "Bluetooth Adapter not present. Can't serve requestDevice.";
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_ADAPTER_NOT_PRESENT);
PostErrorCallback(blink::mojom::WebBluetoothResult::NO_BLUETOOTH_ADAPTER);
return;
}
switch (GetContentClient()->browser()->AllowWebBluetooth(
web_contents_->GetBrowserContext(), requesting_origin,
embedding_origin)) {
case ContentBrowserClient::AllowWebBluetoothResult::BLOCK_POLICY: {
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_POLICY_DISABLED);
PostErrorCallback(blink::mojom::WebBluetoothResult::
CHOOSER_NOT_SHOWN_API_LOCALLY_DISABLED);
return;
}
case ContentBrowserClient::AllowWebBluetoothResult::
BLOCK_GLOBALLY_DISABLED: {
// Log to the developer console.
web_contents_->GetMainFrame()->AddMessageToConsole(
blink::mojom::ConsoleMessageLevel::kInfo,
"Bluetooth permission has been blocked.");
// Block requests.
RecordRequestDeviceOutcome(
UMARequestDeviceOutcome::BLUETOOTH_GLOBALLY_DISABLED);
PostErrorCallback(blink::mojom::WebBluetoothResult::
CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED);
return;
}
case ContentBrowserClient::AllowWebBluetoothResult::ALLOW:
break;
}
BluetoothChooser::EventHandler chooser_event_handler =
base::Bind(&BluetoothDeviceChooserController::OnBluetoothChooserEvent,
base::Unretained(this));
if (WebContentsDelegate* delegate = web_contents_->GetDelegate()) {
chooser_ = delegate->RunBluetoothChooser(render_frame_host_,
std::move(chooser_event_handler));
}
if (!chooser_.get()) {
PostErrorCallback(
blink::mojom::WebBluetoothResult::WEB_BLUETOOTH_NOT_SUPPORTED);
return;
}
if (!chooser_->CanAskForScanningPermission()) {
DVLOG(1) << "Closing immediately because Chooser cannot obtain permission.";
OnBluetoothChooserEvent(BluetoothChooser::Event::DENIED_PERMISSION,
"" /* device_address */);
return;
}
device_ids_.clear();
PopulateConnectedDevices();
if (!chooser_.get()) {
// If the dialog's closing, no need to do any of the rest of this.
return;
}
if (!adapter_->IsPowered()) {
chooser_->SetAdapterPresence(
BluetoothChooser::AdapterPresence::POWERED_OFF);
return;
}
StartDeviceDiscovery();
}
| 17,906 |
17,487 | 0 | SProcXvPutStill(ClientPtr client)
{
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
swaps(&stuff->length);
swapl(&stuff->port);
swapl(&stuff->drawable);
swapl(&stuff->gc);
swaps(&stuff->vid_x);
swaps(&stuff->vid_y);
swaps(&stuff->vid_w);
swaps(&stuff->vid_h);
swaps(&stuff->drw_x);
swaps(&stuff->drw_y);
swaps(&stuff->drw_w);
swaps(&stuff->drw_h);
return XvProcVector[xv_PutStill] (client);
}
| 17,907 |
62,292 | 0 | format_interval(const uint32_t n)
{
static char buf[4][sizeof("0000000.000s")];
static int i = 0;
i = (i + 1) % 4;
snprintf(buf[i], sizeof(buf[i]), "%u.%03us", n / 1000, n % 1000);
return buf[i];
}
| 17,908 |
21,525 | 0 | SYSCALL_DEFINE2(setreuid, uid_t, ruid, uid_t, euid)
{
struct user_namespace *ns = current_user_ns();
const struct cred *old;
struct cred *new;
int retval;
kuid_t kruid, keuid;
kruid = make_kuid(ns, ruid);
keuid = make_kuid(ns, euid);
if ((ruid != (uid_t) -1) && !uid_valid(kruid))
return -EINVAL;
if ((euid != (uid_t) -1) && !uid_valid(keuid))
return -EINVAL;
new = prepare_creds();
if (!new)
return -ENOMEM;
old = current_cred();
retval = -EPERM;
if (ruid != (uid_t) -1) {
new->uid = kruid;
if (!uid_eq(old->uid, kruid) &&
!uid_eq(old->euid, kruid) &&
!nsown_capable(CAP_SETUID))
goto error;
}
if (euid != (uid_t) -1) {
new->euid = keuid;
if (!uid_eq(old->uid, keuid) &&
!uid_eq(old->euid, keuid) &&
!uid_eq(old->suid, keuid) &&
!nsown_capable(CAP_SETUID))
goto error;
}
if (!uid_eq(new->uid, old->uid)) {
retval = set_user(new);
if (retval < 0)
goto error;
}
if (ruid != (uid_t) -1 ||
(euid != (uid_t) -1 && !uid_eq(keuid, old->uid)))
new->suid = new->euid;
new->fsuid = new->euid;
retval = security_task_fix_setuid(new, old, LSM_SETID_RE);
if (retval < 0)
goto error;
return commit_creds(new);
error:
abort_creds(new);
return retval;
}
| 17,909 |
161,595 | 0 | base::string16 GetHelpUrlWithBoard(const std::string& original_url) {
return base::ASCIIToUTF16(original_url +
"&b=" + base::SysInfo::GetLsbReleaseBoard());
}
| 17,910 |
42,181 | 0 | static void perf_callchain_user_32(struct perf_callchain_entry *entry,
struct pt_regs *regs)
{
unsigned int sp, next_sp;
unsigned int next_ip;
unsigned int lr;
long level = 0;
unsigned int __user *fp, *uregs;
next_ip = perf_instruction_pointer(regs);
lr = regs->link;
sp = regs->gpr[1];
perf_callchain_store(entry, next_ip);
while (entry->nr < PERF_MAX_STACK_DEPTH) {
fp = (unsigned int __user *) (unsigned long) sp;
if (!valid_user_sp(sp, 0) || read_user_stack_32(fp, &next_sp))
return;
if (level > 0 && read_user_stack_32(&fp[1], &next_ip))
return;
uregs = signal_frame_32_regs(sp, next_sp, next_ip);
if (!uregs && level <= 1)
uregs = signal_frame_32_regs(sp, next_sp, lr);
if (uregs) {
/*
* This looks like an signal frame, so restart
* the stack trace with the values in it.
*/
if (read_user_stack_32(&uregs[PT_NIP], &next_ip) ||
read_user_stack_32(&uregs[PT_LNK], &lr) ||
read_user_stack_32(&uregs[PT_R1], &sp))
return;
level = 0;
perf_callchain_store(entry, PERF_CONTEXT_USER);
perf_callchain_store(entry, next_ip);
continue;
}
if (level == 0)
next_ip = lr;
perf_callchain_store(entry, next_ip);
++level;
sp = next_sp;
}
}
| 17,911 |
72,766 | 0 | int jas_image_depalettize(jas_image_t *image, int cmptno, int numlutents,
int_fast32_t *lutents, int dtype, int newcmptno)
{
jas_image_cmptparm_t cmptparms;
int_fast32_t v;
int i;
int j;
jas_image_cmpt_t *cmpt;
cmpt = image->cmpts_[cmptno];
cmptparms.tlx = cmpt->tlx_;
cmptparms.tly = cmpt->tly_;
cmptparms.hstep = cmpt->hstep_;
cmptparms.vstep = cmpt->vstep_;
cmptparms.width = cmpt->width_;
cmptparms.height = cmpt->height_;
cmptparms.prec = JAS_IMAGE_CDT_GETPREC(dtype);
cmptparms.sgnd = JAS_IMAGE_CDT_GETSGND(dtype);
if (jas_image_addcmpt(image, newcmptno, &cmptparms)) {
return -1;
}
if (newcmptno <= cmptno) {
++cmptno;
cmpt = image->cmpts_[cmptno];
}
for (j = 0; j < cmpt->height_; ++j) {
for (i = 0; i < cmpt->width_; ++i) {
v = jas_image_readcmptsample(image, cmptno, i, j);
if (v < 0) {
v = 0;
} else if (v >= numlutents) {
v = numlutents - 1;
}
jas_image_writecmptsample(image, newcmptno, i, j,
lutents[v]);
}
}
return 0;
}
| 17,912 |
144,013 | 0 | png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
{
png_size_t num_checked = png_ptr->sig_bytes,
num_to_check = 8 - num_checked;
if (png_ptr->buffer_size < num_to_check)
{
num_to_check = png_ptr->buffer_size;
}
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
num_to_check);
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
{
if (num_checked < 4 &&
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
png_error(png_ptr, "Not a PNG file");
else
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
}
else
{
if (png_ptr->sig_bytes >= 8)
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
}
}
| 17,913 |
40,012 | 0 | cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
bool wait_flag, bool posix_lck, int lock, int unlock,
unsigned int xid)
{
int rc = 0;
__u64 length = 1 + flock->fl_end - flock->fl_start;
struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data;
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
struct TCP_Server_Info *server = tcon->ses->server;
struct inode *inode = cfile->dentry->d_inode;
if (posix_lck) {
int posix_lock_type;
rc = cifs_posix_lock_set(file, flock);
if (!rc || rc < 0)
return rc;
if (type & server->vals->shared_lock_type)
posix_lock_type = CIFS_RDLCK;
else
posix_lock_type = CIFS_WRLCK;
if (unlock == 1)
posix_lock_type = CIFS_UNLCK;
rc = CIFSSMBPosixLock(xid, tcon, cfile->fid.netfid,
current->tgid, flock->fl_start, length,
NULL, posix_lock_type, wait_flag);
goto out;
}
if (lock) {
struct cifsLockInfo *lock;
lock = cifs_lock_init(flock->fl_start, length, type);
if (!lock)
return -ENOMEM;
rc = cifs_lock_add_if(cfile, lock, wait_flag);
if (rc < 0) {
kfree(lock);
return rc;
}
if (!rc)
goto out;
/*
* Windows 7 server can delay breaking lease from read to None
* if we set a byte-range lock on a file - break it explicitly
* before sending the lock to the server to be sure the next
* read won't conflict with non-overlapted locks due to
* pagereading.
*/
if (!CIFS_CACHE_WRITE(CIFS_I(inode)) &&
CIFS_CACHE_READ(CIFS_I(inode))) {
cifs_invalidate_mapping(inode);
cifs_dbg(FYI, "Set no oplock for inode=%p due to mand locks\n",
inode);
CIFS_I(inode)->oplock = 0;
}
rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
type, 1, 0, wait_flag);
if (rc) {
kfree(lock);
return rc;
}
cifs_lock_add(cfile, lock);
} else if (unlock)
rc = server->ops->mand_unlock_range(cfile, flock, xid);
out:
if (flock->fl_flags & FL_POSIX)
posix_lock_file_wait(file, flock);
return rc;
}
| 17,914 |
115,955 | 0 | ewk_frame_scroll_set(Evas_Object* ewkFrame, int x, int y)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false);
EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame->view(), false);
smartData->frame->view()->setScrollPosition(WebCore::IntPoint(x, y));
return true;
}
| 17,915 |
64,572 | 0 | int yr_re_ast_split_at_chaining_point(
RE_AST* re_ast,
RE_AST** result_re_ast,
RE_AST** remainder_re_ast,
int32_t* min_gap,
int32_t* max_gap)
{
RE_NODE* node = re_ast->root_node;
RE_NODE* child = re_ast->root_node->left;
RE_NODE* parent = NULL;
int result;
*result_re_ast = re_ast;
*remainder_re_ast = NULL;
*min_gap = 0;
*max_gap = 0;
while (child != NULL && child->type == RE_NODE_CONCAT)
{
if (child->right != NULL &&
child->right->type == RE_NODE_RANGE_ANY &&
child->right->greedy == FALSE &&
(child->right->start > STRING_CHAINING_THRESHOLD ||
child->right->end > STRING_CHAINING_THRESHOLD))
{
result = yr_re_ast_create(remainder_re_ast);
if (result != ERROR_SUCCESS)
return result;
(*remainder_re_ast)->root_node = child->left;
(*remainder_re_ast)->flags = re_ast->flags;
child->left = NULL;
if (parent != NULL)
parent->left = node->right;
else
(*result_re_ast)->root_node = node->right;
node->right = NULL;
*min_gap = child->right->start;
*max_gap = child->right->end;
yr_re_node_destroy(node);
return ERROR_SUCCESS;
}
parent = node;
node = child;
child = child->left;
}
return ERROR_SUCCESS;
}
| 17,916 |
14,357 | 0 | static int dtls1_preprocess_fragment(SSL *s,struct hm_header_st *msg_hdr,int max)
{
size_t frag_off,frag_len,msg_len;
msg_len = msg_hdr->msg_len;
frag_off = msg_hdr->frag_off;
frag_len = msg_hdr->frag_len;
/* sanity checking */
if ( (frag_off+frag_len) > msg_len)
{
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT,SSL_R_EXCESSIVE_MESSAGE_SIZE);
return SSL_AD_ILLEGAL_PARAMETER;
}
if ( (frag_off+frag_len) > (unsigned long)max)
{
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT,SSL_R_EXCESSIVE_MESSAGE_SIZE);
return SSL_AD_ILLEGAL_PARAMETER;
}
if ( s->d1->r_msg_hdr.frag_off == 0) /* first fragment */
{
/* msg_len is limited to 2^24, but is effectively checked
* against max above */
if (!BUF_MEM_grow_clean(s->init_buf,msg_len+DTLS1_HM_HEADER_LENGTH))
{
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT,ERR_R_BUF_LIB);
return SSL_AD_INTERNAL_ERROR;
}
s->s3->tmp.message_size = msg_len;
s->d1->r_msg_hdr.msg_len = msg_len;
s->s3->tmp.message_type = msg_hdr->type;
s->d1->r_msg_hdr.type = msg_hdr->type;
s->d1->r_msg_hdr.seq = msg_hdr->seq;
}
else if (msg_len != s->d1->r_msg_hdr.msg_len)
{
/* They must be playing with us! BTW, failure to enforce
* upper limit would open possibility for buffer overrun. */
SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT,SSL_R_EXCESSIVE_MESSAGE_SIZE);
return SSL_AD_ILLEGAL_PARAMETER;
}
return 0; /* no error */
}
| 17,917 |
57,088 | 0 | static int nfs41_proc_reclaim_complete(struct nfs_client *clp,
struct rpc_cred *cred)
{
struct nfs4_reclaim_complete_data *calldata;
struct rpc_task *task;
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RECLAIM_COMPLETE],
.rpc_cred = cred,
};
struct rpc_task_setup task_setup_data = {
.rpc_client = clp->cl_rpcclient,
.rpc_message = &msg,
.callback_ops = &nfs4_reclaim_complete_call_ops,
.flags = RPC_TASK_ASYNC,
};
int status = -ENOMEM;
dprintk("--> %s\n", __func__);
calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
if (calldata == NULL)
goto out;
calldata->clp = clp;
calldata->arg.one_fs = 0;
nfs4_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 0);
nfs4_set_sequence_privileged(&calldata->arg.seq_args);
msg.rpc_argp = &calldata->arg;
msg.rpc_resp = &calldata->res;
task_setup_data.callback_data = calldata;
task = rpc_run_task(&task_setup_data);
if (IS_ERR(task)) {
status = PTR_ERR(task);
goto out;
}
status = nfs4_wait_for_completion_rpc_task(task);
if (status == 0)
status = task->tk_status;
rpc_put_task(task);
return 0;
out:
dprintk("<-- %s status=%d\n", __func__, status);
return status;
}
| 17,918 |
151,741 | 0 | void Browser::ShowModalSigninErrorWindow() {
signin_view_controller_.ShowModalSigninErrorDialog(this);
}
| 17,919 |
64,648 | 0 | static int backref_match_at_nested_level(regex_t* reg
, OnigStackType* top, OnigStackType* stk_base
, int ignore_case, int case_fold_flag
, int nest, int mem_num, UChar* memp, UChar** s, const UChar* send)
{
UChar *ss, *p, *pstart, *pend = NULL_UCHARP;
int level;
OnigStackType* k;
level = 0;
k = top;
k--;
while (k >= stk_base) {
if (k->type == STK_CALL_FRAME) {
level--;
}
else if (k->type == STK_RETURN) {
level++;
}
else if (level == nest) {
if (k->type == STK_MEM_START) {
if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) {
pstart = k->u.mem.pstr;
if (pend != NULL_UCHARP) {
if (pend - pstart > send - *s) return 0; /* or goto next_mem; */
p = pstart;
ss = *s;
if (ignore_case != 0) {
if (string_cmp_ic(reg->enc, case_fold_flag,
pstart, &ss, (int )(pend - pstart)) == 0)
return 0; /* or goto next_mem; */
}
else {
while (p < pend) {
if (*p++ != *ss++) return 0; /* or goto next_mem; */
}
}
*s = ss;
return 1;
}
}
}
else if (k->type == STK_MEM_END) {
if (mem_is_in_memp(k->u.mem.num, mem_num, memp)) {
pend = k->u.mem.pstr;
}
}
}
k--;
}
return 0;
}
| 17,920 |
40,401 | 0 | static int sco_sock_listen(struct socket *sock, int backlog)
{
struct sock *sk = sock->sk;
bdaddr_t *src = &sco_pi(sk)->src;
int err = 0;
BT_DBG("sk %p backlog %d", sk, backlog);
lock_sock(sk);
if (sk->sk_state != BT_BOUND) {
err = -EBADFD;
goto done;
}
if (sk->sk_type != SOCK_SEQPACKET) {
err = -EINVAL;
goto done;
}
write_lock(&sco_sk_list.lock);
if (__sco_get_sock_listen_by_addr(src)) {
err = -EADDRINUSE;
goto unlock;
}
sk->sk_max_ack_backlog = backlog;
sk->sk_ack_backlog = 0;
sk->sk_state = BT_LISTEN;
unlock:
write_unlock(&sco_sk_list.lock);
done:
release_sock(sk);
return err;
}
| 17,921 |
48,904 | 0 | static int netif_alloc_netdev_queues(struct net_device *dev)
{
unsigned int count = dev->num_tx_queues;
struct netdev_queue *tx;
size_t sz = count * sizeof(*tx);
if (count < 1 || count > 0xffff)
return -EINVAL;
tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
if (!tx) {
tx = vzalloc(sz);
if (!tx)
return -ENOMEM;
}
dev->_tx = tx;
netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
spin_lock_init(&dev->tx_global_lock);
return 0;
}
| 17,922 |
116,941 | 0 | void IndexedDBDispatcher::OnSuccessCursorPrefetch(
const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p) {
DCHECK_EQ(p.thread_id, CurrentWorkerId());
int32 response_id = p.response_id;
int32 cursor_id = p.cursor_id;
const std::vector<IndexedDBKey>& keys = p.keys;
const std::vector<IndexedDBKey>& primary_keys = p.primary_keys;
const std::vector<content::SerializedScriptValue>& values = p.values;
RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
DCHECK(cursor);
cursor->SetPrefetchData(keys, primary_keys, values);
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
DCHECK(callbacks);
cursor->CachedContinue(callbacks);
pending_callbacks_.Remove(response_id);
}
| 17,923 |
56,328 | 0 | static double filter_hanning(const double x)
{
/* A Cosine windowing function */
return(0.5 + 0.5 * cos(M_PI * x));
}
| 17,924 |
81,828 | 0 | static int add_entry(int idx, ecc_point *g)
{
unsigned x, y;
/* allocate base and LUT */
fp_cache[idx].g = wc_ecc_new_point();
if (fp_cache[idx].g == NULL) {
return GEN_MEM_ERR;
}
/* copy x and y */
if ((mp_copy(g->x, fp_cache[idx].g->x) != MP_OKAY) ||
(mp_copy(g->y, fp_cache[idx].g->y) != MP_OKAY) ||
(mp_copy(g->z, fp_cache[idx].g->z) != MP_OKAY)) {
wc_ecc_del_point(fp_cache[idx].g);
fp_cache[idx].g = NULL;
return GEN_MEM_ERR;
}
for (x = 0; x < (1U<<FP_LUT); x++) {
fp_cache[idx].LUT[x] = wc_ecc_new_point();
if (fp_cache[idx].LUT[x] == NULL) {
for (y = 0; y < x; y++) {
wc_ecc_del_point(fp_cache[idx].LUT[y]);
fp_cache[idx].LUT[y] = NULL;
}
wc_ecc_del_point(fp_cache[idx].g);
fp_cache[idx].g = NULL;
fp_cache[idx].lru_count = 0;
return GEN_MEM_ERR;
}
}
fp_cache[idx].lru_count = 0;
return MP_OKAY;
}
| 17,925 |
62,999 | 0 | static int nested_vmx_check_io_bitmap_controls(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12)
{
if (!nested_cpu_has(vmcs12, CPU_BASED_USE_IO_BITMAPS))
return 0;
if (!page_address_valid(vcpu, vmcs12->io_bitmap_a) ||
!page_address_valid(vcpu, vmcs12->io_bitmap_b))
return -EINVAL;
return 0;
}
| 17,926 |
61,401 | 0 | static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
AVStream *st, MOVStreamContext *sc,
int64_t size)
{
int ret;
if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) {
if ((int)size != size)
return AVERROR(ENOMEM);
ret = ff_get_extradata(c->fc, st->codecpar, pb, size);
if (ret < 0)
return ret;
if (size > 16) {
MOVStreamContext *tmcd_ctx = st->priv_data;
int val;
val = AV_RB32(st->codecpar->extradata + 4);
tmcd_ctx->tmcd_flags = val;
st->avg_frame_rate.num = st->codecpar->extradata[16]; /* number of frame */
st->avg_frame_rate.den = 1;
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
st->codec->time_base = av_inv_q(st->avg_frame_rate);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* adjust for per frame dur in counter mode */
if (tmcd_ctx->tmcd_flags & 0x0008) {
int timescale = AV_RB32(st->codecpar->extradata + 8);
int framedur = AV_RB32(st->codecpar->extradata + 12);
st->avg_frame_rate.num *= timescale;
st->avg_frame_rate.den *= framedur;
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
st->codec->time_base.den *= timescale;
st->codec->time_base.num *= framedur;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (size > 30) {
uint32_t len = AV_RB32(st->codecpar->extradata + 18); /* name atom length */
uint32_t format = AV_RB32(st->codecpar->extradata + 22);
if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) {
uint16_t str_size = AV_RB16(st->codecpar->extradata + 26); /* string length */
if (str_size > 0 && size >= (int)str_size + 26) {
char *reel_name = av_malloc(str_size + 1);
if (!reel_name)
return AVERROR(ENOMEM);
memcpy(reel_name, st->codecpar->extradata + 30, str_size);
reel_name[str_size] = 0; /* Add null terminator */
/* don't add reel_name if emtpy string */
if (*reel_name == 0) {
av_free(reel_name);
} else {
av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL);
}
}
}
}
}
} else {
/* other codec type, just skip (rtp, mp4s ...) */
avio_skip(pb, size);
}
return 0;
}
| 17,927 |
40,852 | 0 | wkbReadDouble(wkbObj *w)
{
double d;
memcpy(&d, w->ptr, sizeof(double));
w->ptr += sizeof(double);
return d;
}
| 17,928 |
73,002 | 0 | static inline long decode_twos_comp(ulong c, int prec)
{
long result;
assert(prec >= 2);
jas_eprintf("warning: support for signed data is untested\n");
result = (c & ((1 << (prec - 1)) - 1)) - (c & (1 << (prec - 1)));
return result;
}
| 17,929 |
9,758 | 0 | static void virgl_cmd_set_scanout(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
{
struct virtio_gpu_set_scanout ss;
struct virgl_renderer_resource_info info;
int ret;
VIRTIO_GPU_FILL_CMD(ss);
trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,
ss.r.width, ss.r.height, ss.r.x, ss.r.y);
if (ss.scanout_id >= g->conf.max_outputs) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal scanout id specified %d",
__func__, ss.scanout_id);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID;
return;
}
g->enable = 1;
memset(&info, 0, sizeof(info));
if (ss.resource_id && ss.r.width && ss.r.height) {
ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
if (ret == -1) {
qemu_log_mask(LOG_GUEST_ERROR,
"%s: illegal resource specified %d\n",
__func__, ss.resource_id);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
return;
}
qemu_console_resize(g->scanout[ss.scanout_id].con,
ss.r.width, ss.r.height);
virgl_renderer_force_ctx_0();
dpy_gl_scanout(g->scanout[ss.scanout_id].con, info.tex_id,
info.flags & 1 /* FIXME: Y_0_TOP */,
info.width, info.height,
ss.r.x, ss.r.y, ss.r.width, ss.r.height);
} else {
if (ss.scanout_id != 0) {
dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL);
}
dpy_gl_scanout(g->scanout[ss.scanout_id].con, 0, false,
0, 0, 0, 0, 0, 0);
}
g->scanout[ss.scanout_id].resource_id = ss.resource_id;
}
| 17,930 |
46,722 | 0 | static int __init init(void)
{
int ret;
if (!crypt_s390_func_available(KIMD_SHA_512, CRYPT_S390_MSA))
return -EOPNOTSUPP;
if ((ret = crypto_register_shash(&sha512_alg)) < 0)
goto out;
if ((ret = crypto_register_shash(&sha384_alg)) < 0)
crypto_unregister_shash(&sha512_alg);
out:
return ret;
}
| 17,931 |
122,076 | 0 | APIPermission* CreateAPIPermission(const APIPermissionInfo* permission) {
return new T(permission);
}
| 17,932 |
156,653 | 0 | void FocusInputInFrame(RenderFrameHostImpl* frame) {
ASSERT_TRUE(ExecuteScript(frame, "window.focus(); input.focus();"));
}
| 17,933 |
89,300 | 0 | int eeprom_write_enable(unsigned dev_addr, int state)
{
kw_gpio_set_value(KM_KIRKWOOD_ENV_WP, !state);
return !kw_gpio_get_value(KM_KIRKWOOD_ENV_WP);
}
| 17,934 |
89,949 | 0 | _krb5_get_init_creds_opt_free_pkinit(krb5_get_init_creds_opt *opt)
{
#ifdef PKINIT
krb5_pk_init_ctx ctx;
if (opt->opt_private == NULL || opt->opt_private->pk_init_ctx == NULL)
return;
ctx = opt->opt_private->pk_init_ctx;
switch (ctx->keyex) {
case USE_DH:
if (ctx->u.dh)
DH_free(ctx->u.dh);
break;
case USE_RSA:
break;
case USE_ECDH:
if (ctx->u.eckey)
_krb5_pk_eckey_free(ctx->u.eckey);
break;
}
if (ctx->id) {
hx509_verify_destroy_ctx(ctx->id->verify_ctx);
hx509_certs_free(&ctx->id->certs);
hx509_cert_free(ctx->id->cert);
hx509_certs_free(&ctx->id->anchors);
hx509_certs_free(&ctx->id->certpool);
if (ctx->clientDHNonce) {
krb5_free_data(NULL, ctx->clientDHNonce);
ctx->clientDHNonce = NULL;
}
if (ctx->m)
_krb5_free_moduli(ctx->m);
free(ctx->id);
ctx->id = NULL;
}
free(opt->opt_private->pk_init_ctx);
opt->opt_private->pk_init_ctx = NULL;
#endif
}
| 17,935 |
188,281 | 1 | long long Segment::CreateInstance(
IMkvReader* pReader,
long long pos,
Segment*& pSegment)
{
assert(pReader);
assert(pos >= 0);
pSegment = NULL;
long long total, available;
const long status = pReader->Length(&total, &available);
if (status < 0) //error
return status;
if (available < 0)
return -1;
if ((total >= 0) && (available > total))
return -1;
//I would assume that in practice this loop would execute
//exactly once, but we allow for other elements (e.g. Void)
//to immediately follow the EBML header. This is fine for
//the source filter case (since the entire file is available),
//but in the splitter case over a network we should probably
//just give up early. We could for example decide only to
//execute this loop a maximum of, say, 10 times.
//TODO:
//There is an implied "give up early" by only parsing up
//to the available limit. We do do that, but only if the
//total file size is unknown. We could decide to always
//use what's available as our limit (irrespective of whether
//we happen to know the total file length). This would have
//as its sense "parse this much of the file before giving up",
//which a slightly different sense from "try to parse up to
//10 EMBL elements before giving up".
for (;;)
{
if ((total >= 0) && (pos >= total))
return E_FILE_FORMAT_INVALID;
//Read ID
long len;
long long result = GetUIntLength(pReader, pos, len);
if (result) //error, or too few available bytes
return result;
if ((total >= 0) && ((pos + len) > total))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > available)
return pos + len;
const long long idpos = pos;
const long long id = ReadUInt(pReader, pos, len);
if (id < 0) //error
return id;
pos += len; //consume ID
//Read Size
result = GetUIntLength(pReader, pos, len);
if (result) //error, or too few available bytes
return result;
if ((total >= 0) && ((pos + len) > total))
return E_FILE_FORMAT_INVALID;
if ((pos + len) > available)
return pos + len;
long long size = ReadUInt(pReader, pos, len);
if (size < 0) //error
return size;
pos += len; //consume length of size of element
//Pos now points to start of payload
//Handle "unknown size" for live streaming of webm files.
const long long unknown_size = (1LL << (7 * len)) - 1;
if (id == 0x08538067) //Segment ID
{
if (size == unknown_size)
size = -1;
else if (total < 0)
size = -1;
else if ((pos + size) > total)
size = -1;
pSegment = new (std::nothrow) Segment(
pReader,
idpos,
//elem_size
pos,
size);
if (pSegment == 0)
return -1; //generic error
return 0; //success
}
if (size == unknown_size)
return E_FILE_FORMAT_INVALID;
if ((total >= 0) && ((pos + size) > total))
return E_FILE_FORMAT_INVALID;
if ((pos + size) > available)
return pos + size;
pos += size; //consume payload
}
}
| 17,936 |
75,139 | 0 | zone_set_steps(int zone_index, int interval)
{
struct map_zone* zone;
zone = vector_get(s_map->zones, zone_index);
zone->interval = interval;
zone->steps_left = 0;
}
| 17,937 |
168,696 | 0 | void UiSceneCreator::CreateWebVrUrlToast() {
auto* parent =
AddTransientParent(kWebVrUrlToastTransientParent, kWebVrViewportAwareRoot,
kWebVrUrlToastTimeoutSeconds, true, scene_);
parent->AddBinding(VR_BIND_FUNC(bool, Model, model_,
web_vr_started_for_autopresentation &&
!model->web_vr_show_splash_screen &&
model->web_vr_has_produced_frames(),
UiElement, parent, SetVisible));
auto element = base::MakeUnique<WebVrUrlToast>(
512, base::Bind(&UiBrowserInterface::OnUnsupportedMode,
base::Unretained(browser_)));
element->SetName(kWebVrUrlToast);
element->set_opacity_when_visible(0.8f);
element->SetDrawPhase(kPhaseOverlayForeground);
element->set_hit_testable(false);
element->SetTranslate(0, kWebVrToastDistance * sin(kWebVrUrlToastRotationRad),
-kWebVrToastDistance * cos(kWebVrUrlToastRotationRad));
element->SetRotate(1, 0, 0, kWebVrUrlToastRotationRad);
element->SetSize(kWebVrUrlToastWidth, kWebVrUrlToastHeight);
BindColor(model_, element.get(),
&ColorScheme::web_vr_transient_toast_background,
&TexturedElement::SetBackgroundColor);
BindColor(model_, element.get(),
&ColorScheme::web_vr_transient_toast_foreground,
&TexturedElement::SetForegroundColor);
element->AddBinding(VR_BIND_FUNC(ToolbarState, Model, model_, toolbar_state,
WebVrUrlToast, element.get(),
SetToolbarState));
scene_->AddUiElement(kWebVrUrlToastTransientParent, std::move(element));
}
| 17,938 |
134,480 | 0 | HomePageUndoBubble::~HomePageUndoBubble() {
}
| 17,939 |
127,496 | 0 | static ImageOrientation readImageOrientation(jpeg_decompress_struct* info)
{
const unsigned orientationTag = 0x112;
const unsigned shortType = 3;
for (jpeg_saved_marker_ptr marker = info->marker_list; marker; marker = marker->next) {
bool isBigEndian;
unsigned ifdOffset;
if (!checkExifHeader(marker, isBigEndian, ifdOffset))
continue;
const unsigned offsetToTiffData = 6; // Account for 'Exif\0<fill byte>' header.
if (marker->data_length < offsetToTiffData || ifdOffset >= marker->data_length - offsetToTiffData)
continue;
ifdOffset += offsetToTiffData;
JOCTET* ifd = marker->data + ifdOffset;
JOCTET* end = marker->data + marker->data_length;
if (end - ifd < 2)
continue;
unsigned tagCount = readUint16(ifd, isBigEndian);
ifd += 2; // Skip over the uint16 that was just read.
const int ifdEntrySize = 12;
for (unsigned i = 0; i < tagCount && end - ifd >= ifdEntrySize; ++i, ifd += ifdEntrySize) {
unsigned tag = readUint16(ifd, isBigEndian);
unsigned type = readUint16(ifd + 2, isBigEndian);
unsigned count = readUint32(ifd + 4, isBigEndian);
if (tag == orientationTag && type == shortType && count == 1)
return ImageOrientation::fromEXIFValue(readUint16(ifd + 8, isBigEndian));
}
}
return ImageOrientation();
}
| 17,940 |
103,590 | 0 | static void willRemoveChild(Node* child)
{
#if ENABLE(MUTATION_OBSERVERS)
ASSERT(child->parentNode());
ChildListMutationScope(child->parentNode()).willRemoveChild(child);
child->notifyMutationObserversNodeWillDetach();
#endif
dispatchChildRemovalEvents(child);
child->document()->nodeWillBeRemoved(child); // e.g. mutation event listener can create a new range.
ChildFrameDisconnector(child).disconnect();
}
| 17,941 |
181,957 | 1 | lrmd_remote_listen(gpointer data)
{
int csock = 0;
int flag = 0;
unsigned laddr = 0;
struct sockaddr addr;
gnutls_session_t *session = NULL;
crm_client_t *new_client = NULL;
static struct mainloop_fd_callbacks lrmd_remote_fd_cb = {
.dispatch = lrmd_remote_client_msg,
.destroy = lrmd_remote_client_destroy,
};
laddr = sizeof(addr);
memset(&addr, 0, sizeof(addr));
getsockname(ssock, &addr, &laddr);
/* accept the connection */
if (addr.sa_family == AF_INET6) {
struct sockaddr_in6 sa;
char addr_str[INET6_ADDRSTRLEN];
laddr = sizeof(sa);
memset(&sa, 0, sizeof(sa));
csock = accept(ssock, &sa, &laddr);
get_ip_str((struct sockaddr *)&sa, addr_str, INET6_ADDRSTRLEN);
crm_info("New remote connection from %s", addr_str);
} else {
struct sockaddr_in sa;
char addr_str[INET_ADDRSTRLEN];
laddr = sizeof(sa);
memset(&sa, 0, sizeof(sa));
csock = accept(ssock, &sa, &laddr);
get_ip_str((struct sockaddr *)&sa, addr_str, INET_ADDRSTRLEN);
crm_info("New remote connection from %s", addr_str);
}
if (csock == -1) {
crm_err("accept socket failed");
return TRUE;
}
if ((flag = fcntl(csock, F_GETFL)) >= 0) {
if (fcntl(csock, F_SETFL, flag | O_NONBLOCK) < 0) {
crm_err("fcntl() write failed");
close(csock);
return TRUE;
}
} else {
crm_err("fcntl() read failed");
close(csock);
return TRUE;
}
session = create_psk_tls_session(csock, GNUTLS_SERVER, psk_cred_s);
if (session == NULL) {
crm_err("TLS session creation failed");
close(csock);
return TRUE;
}
new_client = calloc(1, sizeof(crm_client_t));
new_client->remote = calloc(1, sizeof(crm_remote_t));
new_client->kind = CRM_CLIENT_TLS;
new_client->remote->tls_session = session;
new_client->id = crm_generate_uuid();
new_client->remote->auth_timeout =
g_timeout_add(LRMD_REMOTE_AUTH_TIMEOUT, lrmd_auth_timeout_cb, new_client);
crm_notice("LRMD client connection established. %p id: %s", new_client, new_client->id);
new_client->remote->source =
mainloop_add_fd("lrmd-remote-client", G_PRIORITY_DEFAULT, csock, new_client,
&lrmd_remote_fd_cb);
g_hash_table_insert(client_connections, new_client->id, new_client);
/* Alert other clients of the new connection *
notify_of_new_client(new_client);
return TRUE;
}
| 17,942 |
60,460 | 0 | static RFlagItem *evalFlag(RFlag *f, RFlagItem *item) {
if (item && item->alias) {
item->offset = r_num_math (f->num, item->alias);
}
return item;
}
| 17,943 |
67,983 | 0 | find_KRB5SignedPath(krb5_context context,
const AuthorizationData *ad,
krb5_data *data)
{
AuthorizationData child;
krb5_error_code ret;
int pos;
if (ad == NULL || ad->len == 0)
return KRB5KDC_ERR_PADATA_TYPE_NOSUPP;
pos = ad->len - 1;
if (ad->val[pos].ad_type != KRB5_AUTHDATA_IF_RELEVANT)
return KRB5KDC_ERR_PADATA_TYPE_NOSUPP;
ret = decode_AuthorizationData(ad->val[pos].ad_data.data,
ad->val[pos].ad_data.length,
&child,
NULL);
if (ret) {
krb5_set_error_message(context, ret, "Failed to decode "
"IF_RELEVANT with %d", ret);
return ret;
}
if (child.len != 1) {
free_AuthorizationData(&child);
return KRB5KDC_ERR_PADATA_TYPE_NOSUPP;
}
if (child.val[0].ad_type != KRB5_AUTHDATA_SIGNTICKET) {
free_AuthorizationData(&child);
return KRB5KDC_ERR_PADATA_TYPE_NOSUPP;
}
if (data)
ret = der_copy_octet_string(&child.val[0].ad_data, data);
free_AuthorizationData(&child);
return ret;
}
| 17,944 |
67,412 | 0 | static int atomic_open(struct nameidata *nd, struct dentry *dentry,
struct path *path, struct file *file,
const struct open_flags *op,
int open_flag, umode_t mode,
int *opened)
{
struct dentry *const DENTRY_NOT_SET = (void *) -1UL;
struct inode *dir = nd->path.dentry->d_inode;
int error;
if (!(~open_flag & (O_EXCL | O_CREAT))) /* both O_EXCL and O_CREAT */
open_flag &= ~O_TRUNC;
if (nd->flags & LOOKUP_DIRECTORY)
open_flag |= O_DIRECTORY;
file->f_path.dentry = DENTRY_NOT_SET;
file->f_path.mnt = nd->path.mnt;
error = dir->i_op->atomic_open(dir, dentry, file,
open_to_namei_flags(open_flag),
mode, opened);
d_lookup_done(dentry);
if (!error) {
/*
* We didn't have the inode before the open, so check open
* permission here.
*/
int acc_mode = op->acc_mode;
if (*opened & FILE_CREATED) {
WARN_ON(!(open_flag & O_CREAT));
fsnotify_create(dir, dentry);
acc_mode = 0;
}
error = may_open(&file->f_path, acc_mode, open_flag);
if (WARN_ON(error > 0))
error = -EINVAL;
} else if (error > 0) {
if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) {
error = -EIO;
} else {
if (file->f_path.dentry) {
dput(dentry);
dentry = file->f_path.dentry;
}
if (*opened & FILE_CREATED)
fsnotify_create(dir, dentry);
if (unlikely(d_is_negative(dentry))) {
error = -ENOENT;
} else {
path->dentry = dentry;
path->mnt = nd->path.mnt;
return 1;
}
}
}
dput(dentry);
return error;
}
| 17,945 |
82,727 | 0 | INST_HANDLER (lac) { // LAC Z, Rd
int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);
__generic_ld_st (op, "ram", 'z', 1, 0, 0, 0); // 0: Read (RAMPZ:Z)
ESIL_A ("r%d,0xff,^,&,", d); // 0: (Z) & ~Rd
ESIL_A ("DUP,r%d,=,", d); // Rd = [0]
__generic_ld_st (op, "ram", 'z', 1, 0, 0, 1); // Store in RAM
}
| 17,946 |
184,315 | 1 | const PPB_NaCl_Private* GetNaclInterface() {
pp::Module *module = pp::Module::Get();
CHECK(module);
return static_cast<const PPB_NaCl_Private*>(
module->GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
}
| 17,947 |
106,546 | 0 | void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, PassRefPtr<DataCallback> prpCallback)
{
RefPtr<DataCallback> callback = prpCallback;
if (!isValid()) {
callback->invalidate();
return;
}
uint64_t callbackID = callback->callbackID();
m_dataCallbacks.set(callbackID, callback.get());
process()->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
}
| 17,948 |
120,558 | 0 | bool Element::isSpellCheckingEnabled() const
{
for (const Element* element = this; element; element = element->parentOrShadowHostElement()) {
switch (element->spellcheckAttributeState()) {
case SpellcheckAttributeTrue:
return true;
case SpellcheckAttributeFalse:
return false;
case SpellcheckAttributeDefault:
break;
}
}
return true;
}
| 17,949 |
180,177 | 1 | int read_header_tga(gdIOCtx *ctx, oTga *tga)
{
unsigned char header[18];
if (gdGetBuf(header, sizeof(header), ctx) < 18) {
gd_error("fail to read header");
return -1;
}
tga->identsize = header[0];
tga->colormaptype = header[1];
tga->imagetype = header[2];
tga->colormapstart = header[3] + (header[4] << 8);
tga->colormaplength = header[5] + (header[6] << 8);
tga->colormapbits = header[7];
tga->xstart = header[8] + (header[9] << 8);
tga->ystart = header[10] + (header[11] << 8);
tga->width = header[12] + (header[13] << 8);
tga->height = header[14] + (header[15] << 8);
tga->bits = header[16];
tga->alphabits = header[17] & 0x0f;
tga->fliph = (header[17] & 0x10) ? 1 : 0;
tga->flipv = (header[17] & 0x20) ? 0 : 1;
#if DEBUG
printf("format bps: %i\n", tga->bits);
printf("flip h/v: %i / %i\n", tga->fliph, tga->flipv);
printf("alpha: %i\n", tga->alphabits);
printf("wxh: %i %i\n", tga->width, tga->height);
#endif
switch(tga->bits) {
case 8:
case 16:
case 24:
case 32:
break;
default:
gd_error("bps %i not supported", tga->bits);
return -1;
break;
}
tga->ident = NULL;
if (tga->identsize > 0) {
tga->ident = (char *) gdMalloc(tga->identsize * sizeof(char));
if(tga->ident == NULL) {
return -1;
}
gdGetBuf(tga->ident, tga->identsize, ctx);
}
return 1;
}
| 17,950 |
67,417 | 0 | static int do_o_path(struct nameidata *nd, unsigned flags, struct file *file)
{
struct path path;
int error = path_lookupat(nd, flags, &path);
if (!error) {
audit_inode(nd->name, path.dentry, 0);
error = vfs_open(&path, file, current_cred());
path_put(&path);
}
return error;
}
| 17,951 |
104,238 | 0 | void RTCPeerConnection::close(ExceptionCode& ec)
{
if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) {
ec = INVALID_STATE_ERR;
return;
}
changeIceState(IceStateClosed);
changeReadyState(ReadyStateClosed);
stop();
}
| 17,952 |
94,231 | 0 | static struct addrinfo *lookuphost(const char *hostname, in_port_t port)
{
struct addrinfo *ai = 0;
struct addrinfo hints = { .ai_family = AF_UNSPEC,
.ai_protocol = IPPROTO_TCP,
.ai_socktype = SOCK_STREAM };
char service[NI_MAXSERV];
int error;
(void)snprintf(service, NI_MAXSERV, "%d", port);
if ((error = getaddrinfo(hostname, service, &hints, &ai)) != 0) {
if (error != EAI_SYSTEM) {
fprintf(stderr, "getaddrinfo(): %s\n", gai_strerror(error));
} else {
perror("getaddrinfo()");
}
}
return ai;
}
| 17,953 |
177,751 | 1 | add_range(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, unsigned int out, int check_for_overlap, int many)
{
int current;
cmap_splay *tree;
if (low > high)
{
fz_warn(ctx, "range limits out of range in cmap %s", cmap->cmap_name);
return;
}
tree = cmap->tree;
if (cmap->tlen)
{
unsigned int move = cmap->ttop;
unsigned int gt = EMPTY;
unsigned int lt = EMPTY;
if (check_for_overlap)
{
/* Check for collision with the current node */
do
{
current = move;
/* Cases we might meet:
* tree[i]: <----->
* case 0: <->
* case 1: <------->
* case 2: <------------->
* case 3: <->
* case 4: <------->
* case 5: <->
*/
if (low <= tree[current].low && tree[current].low <= high)
{
/* case 1, reduces to case 0 */
/* or case 2, deleting the node */
tree[current].out += high + 1 - tree[current].low;
tree[current].low = high + 1;
if (tree[current].low > tree[current].high)
{
move = delete_node(cmap, current);
current = EMPTY;
continue;
}
}
else if (low <= tree[current].high && tree[current].high <= high)
{
/* case 4, reduces to case 5 */
tree[current].high = low - 1;
assert(tree[current].low <= tree[current].high);
}
else if (tree[current].low < low && high < tree[current].high)
{
/* case 3, reduces to case 5 */
int new_high = tree[current].high;
tree[current].high = low-1;
add_range(ctx, cmap, high+1, new_high, tree[current].out + high + 1 - tree[current].low, 0, many);
}
/* Now look for where to move to next (left for case 0, right for case 5) */
if (tree[current].low > high) {
move = tree[current].left;
gt = current;
}
else
{
move = tree[current].right;
lt = current;
}
}
while (move != EMPTY);
}
else
{
do
{
current = move;
if (tree[current].low > high)
{
move = tree[current].left;
gt = current;
}
else
{
move = tree[current].right;
lt = current;
}
} while (move != EMPTY);
}
/* current is now the node to which we would be adding the new node */
/* lt is the last node we traversed which is lt the new node. */
/* gt is the last node we traversed which is gt the new node. */
if (!many)
{
/* Check for the 'merge' cases. */
if (lt != EMPTY && !tree[lt].many && tree[lt].high == low-1 && tree[lt].out - tree[lt].low == out - low)
{
tree[lt].high = high;
if (gt != EMPTY && !tree[gt].many && tree[gt].low == high+1 && tree[gt].out - tree[gt].low == out - low)
{
tree[lt].high = tree[gt].high;
delete_node(cmap, gt);
}
goto exit;
}
if (gt != EMPTY && !tree[gt].many && tree[gt].low == high+1 && tree[gt].out - tree[gt].low == out - low)
{
tree[gt].low = low;
tree[gt].out = out;
goto exit;
}
}
}
else
current = EMPTY;
if (cmap->tlen == cmap->tcap)
{
int new_cap = cmap->tcap ? cmap->tcap * 2 : 256;
tree = cmap->tree = fz_resize_array(ctx, cmap->tree, new_cap, sizeof *cmap->tree);
cmap->tcap = new_cap;
}
tree[cmap->tlen].low = low;
tree[cmap->tlen].high = high;
tree[cmap->tlen].out = out;
tree[cmap->tlen].parent = current;
tree[cmap->tlen].left = EMPTY;
tree[cmap->tlen].right = EMPTY;
tree[cmap->tlen].many = many;
cmap->tlen++;
if (current == EMPTY)
cmap->ttop = 0;
else if (tree[current].low > high)
tree[current].left = cmap->tlen-1;
else
{
assert(tree[current].high < low);
tree[current].right = cmap->tlen-1;
}
move_to_root(tree, cmap->tlen-1);
cmap->ttop = cmap->tlen-1;
exit:
{}
#ifdef CHECK_SPLAY
check_splay(cmap->tree, cmap->ttop, 0);
#endif
#ifdef DUMP_SPLAY
dump_splay(cmap->tree, cmap->ttop, 0, "");
#endif
}
| 17,954 |
169,019 | 0 | void OfflinePageModelTaskified::OnCreateArchiveDone(
const SavePageCallback& callback,
OfflinePageItem proposed_page,
OfflinePageArchiver* archiver,
ArchiverResult archiver_result,
const GURL& saved_url,
const base::FilePath& file_path,
const base::string16& title,
int64_t file_size,
const std::string& digest) {
pending_archivers_.erase(
std::find_if(pending_archivers_.begin(), pending_archivers_.end(),
[archiver](const std::unique_ptr<OfflinePageArchiver>& a) {
return a.get() == archiver;
}));
if (archiver_result != ArchiverResult::SUCCESSFULLY_CREATED) {
SavePageResult result = ArchiverResultToSavePageResult(archiver_result);
InformSavePageDone(callback, result, proposed_page);
return;
}
if (proposed_page.url != saved_url) {
DVLOG(1) << "Saved URL does not match requested URL.";
InformSavePageDone(callback, SavePageResult::ARCHIVE_CREATION_FAILED,
proposed_page);
return;
}
proposed_page.file_path = file_path;
proposed_page.file_size = file_size;
proposed_page.title = title;
proposed_page.digest = digest;
AddPage(proposed_page,
base::Bind(&OfflinePageModelTaskified::OnAddPageForSavePageDone,
weak_ptr_factory_.GetWeakPtr(), callback, proposed_page));
}
| 17,955 |
38,272 | 0 | static bool __putback_lru_fast_prepare(struct page *page, struct pagevec *pvec,
int *pgrescued)
{
VM_BUG_ON_PAGE(PageLRU(page), page);
VM_BUG_ON_PAGE(!PageLocked(page), page);
if (page_mapcount(page) <= 1 && page_evictable(page)) {
pagevec_add(pvec, page);
if (TestClearPageUnevictable(page))
(*pgrescued)++;
unlock_page(page);
return true;
}
return false;
}
| 17,956 |
59,487 | 0 | xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) {
if (CMP8(CUR_PTR, 'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N')) {
SKIP(8);
if (SKIP_BLANKS == 0) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after 'NOTATION'\n");
return(0);
}
*tree = xmlParseNotationType(ctxt);
if (*tree == NULL) return(0);
return(XML_ATTRIBUTE_NOTATION);
}
*tree = xmlParseEnumerationType(ctxt);
if (*tree == NULL) return(0);
return(XML_ATTRIBUTE_ENUMERATION);
}
| 17,957 |
66,817 | 0 | char* MACH0_(get_cpusubtype)(struct MACH0_(obj_t)* bin) {
if (bin) {
return MACH0_(get_cpusubtype_from_hdr) (&bin->hdr);
}
return strdup ("Unknown");
}
| 17,958 |
177,092 | 0 | SoftAACEncoder2::~SoftAACEncoder2() {
aacEncClose(&mAACEncoder);
delete[] mInputFrame;
mInputFrame = NULL;
}
| 17,959 |
149,244 | 0 | void HTMLFormControlElement::RequiredAttributeChanged() {
SetNeedsValidityCheck();
PseudoStateChanged(CSSSelector::kPseudoRequired);
PseudoStateChanged(CSSSelector::kPseudoOptional);
if (AXObjectCache* cache = GetDocument().ExistingAXObjectCache())
cache->CheckedStateChanged(this);
}
| 17,960 |
130,948 | 0 | static void overloadedPerWorldMethod1MethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedPerWorldMethod", "TestObject", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
exceptionState.throwIfNeeded();
return;
}
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), exceptionState);
imp->overloadedPerWorldMethod(longArg);
}
| 17,961 |
70,737 | 0 | evutil_hex_char_to_int_(char c)
{
switch(c)
{
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'A': case 'a': return 10;
case 'B': case 'b': return 11;
case 'C': case 'c': return 12;
case 'D': case 'd': return 13;
case 'E': case 'e': return 14;
case 'F': case 'f': return 15;
}
return -1;
}
| 17,962 |
30,180 | 0 | static int __init ftrace_mod_cmd_init(void)
{
return register_ftrace_command(&ftrace_mod_cmd);
}
| 17,963 |
28,592 | 0 | static int qeth_issue_next_read(struct qeth_card *card)
{
int rc;
struct qeth_cmd_buffer *iob;
QETH_CARD_TEXT(card, 5, "issnxrd");
if (card->read.state != CH_STATE_UP)
return -EIO;
iob = qeth_get_buffer(&card->read);
if (!iob) {
dev_warn(&card->gdev->dev, "The qeth device driver "
"failed to recover an error on the device\n");
QETH_DBF_MESSAGE(2, "%s issue_next_read failed: no iob "
"available\n", dev_name(&card->gdev->dev));
return -ENOMEM;
}
qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE);
QETH_CARD_TEXT(card, 6, "noirqpnd");
rc = ccw_device_start(card->read.ccwdev, &card->read.ccw,
(addr_t) iob, 0, 0);
if (rc) {
QETH_DBF_MESSAGE(2, "%s error in starting next read ccw! "
"rc=%i\n", dev_name(&card->gdev->dev), rc);
atomic_set(&card->read.irq_pending, 0);
card->read_or_write_problem = 1;
qeth_schedule_recovery(card);
wake_up(&card->wait_q);
}
return rc;
}
| 17,964 |
100,666 | 0 | ~ScopedBrowserDisplayer() {
if (params_->window_action == browser::NavigateParams::SHOW_WINDOW_INACTIVE)
params_->browser->window()->ShowInactive();
else if (params_->window_action == browser::NavigateParams::SHOW_WINDOW)
params_->browser->window()->Show();
}
| 17,965 |
186,345 | 1 | void PreconnectManager::Start(const GURL& url,
std::vector<PreconnectRequest> requests) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
const std::string host = url.host();
if (preresolve_info_.find(host) != preresolve_info_.end())
return;
auto iterator_and_whether_inserted = preresolve_info_.emplace(
host, std::make_unique<PreresolveInfo>(url, requests.size()));
PreresolveInfo* info = iterator_and_whether_inserted.first->second.get();
for (auto request_it = requests.begin(); request_it != requests.end();
++request_it) {
DCHECK(request_it->origin.GetOrigin() == request_it->origin);
PreresolveJobId job_id = preresolve_jobs_.Add(
std::make_unique<PreresolveJob>(std::move(*request_it), info));
queued_jobs_.push_back(job_id);
}
TryToLaunchPreresolveJobs();
}
| 17,966 |
7,392 | 0 | get_cond(const char *l, const char **t)
{
static const struct cond_tbl_s {
char name[8];
size_t len;
int cond;
} cond_tbl[] = {
{ "if", 2, COND_IF },
{ "elif", 4, COND_ELIF },
{ "else", 4, COND_ELSE },
{ "", 0, COND_NONE },
};
const struct cond_tbl_s *p;
for (p = cond_tbl; p->len; p++) {
if (strncmp(l, p->name, p->len) == 0 &&
isspace((unsigned char)l[p->len])) {
if (t)
*t = l + p->len;
break;
}
}
return p->cond;
}
| 17,967 |
90,854 | 0 | sh4_get_fpscr()
{
int ret;
asm volatile ("sts fpscr,%0" : "=r" (ret));
return ret;
}
| 17,968 |
98,403 | 0 | void webkit_web_frame_layout(WebKitWebFrame* frame)
{
Frame* coreFrame = core(frame);
if (!coreFrame)
return;
FrameView* view = coreFrame->view();
if (!view)
return;
view->layout();
}
| 17,969 |
55,454 | 0 | SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
unsigned int, size, unsigned int, flags)
{
struct sched_attr attr = {
.size = sizeof(struct sched_attr),
};
struct task_struct *p;
int retval;
if (!uattr || pid < 0 || size > PAGE_SIZE ||
size < SCHED_ATTR_SIZE_VER0 || flags)
return -EINVAL;
rcu_read_lock();
p = find_process_by_pid(pid);
retval = -ESRCH;
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
attr.sched_policy = p->policy;
if (p->sched_reset_on_fork)
attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
if (task_has_dl_policy(p))
__getparam_dl(p, &attr);
else if (task_has_rt_policy(p))
attr.sched_priority = p->rt_priority;
else
attr.sched_nice = task_nice(p);
rcu_read_unlock();
retval = sched_read_attr(uattr, &attr, size);
return retval;
out_unlock:
rcu_read_unlock();
return retval;
}
| 17,970 |
137,746 | 0 | explicit Delegate(HeadlessWebContentsImpl* headless_web_contents)
: headless_web_contents_(headless_web_contents) {}
| 17,971 |
81,718 | 0 | static av_cold int dct_init(MpegEncContext *s)
{
ff_blockdsp_init(&s->bdsp, s->avctx);
ff_h264chroma_init(&s->h264chroma, 8); //for lowres
ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
ff_mpegvideodsp_init(&s->mdsp);
ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
if (s->avctx->debug & FF_DEBUG_NOMC) {
int i;
for (i=0; i<4; i++) {
s->hdsp.avg_pixels_tab[0][i] = gray16;
s->hdsp.put_pixels_tab[0][i] = gray16;
s->hdsp.put_no_rnd_pixels_tab[0][i] = gray16;
s->hdsp.avg_pixels_tab[1][i] = gray8;
s->hdsp.put_pixels_tab[1][i] = gray8;
s->hdsp.put_no_rnd_pixels_tab[1][i] = gray8;
}
}
s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;
s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;
s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;
s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;
if (s->avctx->flags & AV_CODEC_FLAG_BITEXACT)
s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
if (HAVE_INTRINSICS_NEON)
ff_mpv_common_init_neon(s);
if (ARCH_ALPHA)
ff_mpv_common_init_axp(s);
if (ARCH_ARM)
ff_mpv_common_init_arm(s);
if (ARCH_PPC)
ff_mpv_common_init_ppc(s);
if (ARCH_X86)
ff_mpv_common_init_x86(s);
if (ARCH_MIPS)
ff_mpv_common_init_mips(s);
return 0;
}
| 17,972 |
53,321 | 0 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
{
struct kvm_cpuid_entry2 *best;
struct vcpu_vmx *vmx = to_vmx(vcpu);
u32 secondary_exec_ctl = vmx_secondary_exec_control(vmx);
if (vmx_rdtscp_supported()) {
bool rdtscp_enabled = guest_cpuid_has_rdtscp(vcpu);
if (!rdtscp_enabled)
secondary_exec_ctl &= ~SECONDARY_EXEC_RDTSCP;
if (nested) {
if (rdtscp_enabled)
vmx->nested.nested_vmx_secondary_ctls_high |=
SECONDARY_EXEC_RDTSCP;
else
vmx->nested.nested_vmx_secondary_ctls_high &=
~SECONDARY_EXEC_RDTSCP;
}
}
/* Exposing INVPCID only when PCID is exposed */
best = kvm_find_cpuid_entry(vcpu, 0x7, 0);
if (vmx_invpcid_supported() &&
(!best || !(best->ebx & bit(X86_FEATURE_INVPCID)) ||
!guest_cpuid_has_pcid(vcpu))) {
secondary_exec_ctl &= ~SECONDARY_EXEC_ENABLE_INVPCID;
if (best)
best->ebx &= ~bit(X86_FEATURE_INVPCID);
}
if (cpu_has_secondary_exec_ctrls())
vmcs_set_secondary_exec_control(secondary_exec_ctl);
if (static_cpu_has(X86_FEATURE_PCOMMIT) && nested) {
if (guest_cpuid_has_pcommit(vcpu))
vmx->nested.nested_vmx_secondary_ctls_high |=
SECONDARY_EXEC_PCOMMIT;
else
vmx->nested.nested_vmx_secondary_ctls_high &=
~SECONDARY_EXEC_PCOMMIT;
}
}
| 17,973 |
128,161 | 0 | void CastConfigDelegateChromeos::GetReceiversAndActivities(
const ReceiversAndActivitesCallback& callback) {
ExecuteJavaScriptWithCallback(
"backgroundSetup.getMirrorCapableReceiversAndActivities();",
base::Bind(&GetReceiversAndActivitiesCallback, callback));
}
| 17,974 |
151,654 | 0 | bool Browser::CallBeforeUnloadHandlers(
const base::Callback<void(bool)>& on_close_confirmed) {
cancel_download_confirmation_state_ = RESPONSE_RECEIVED;
if (IsFastTabUnloadEnabled()) {
return fast_unload_controller_->CallBeforeUnloadHandlers(
on_close_confirmed);
}
return unload_controller_->CallBeforeUnloadHandlers(on_close_confirmed);
}
| 17,975 |
3,364 | 0 | zrenamefile(i_ctx_t *i_ctx_p)
{
int code;
os_ptr op = osp;
gs_parsed_file_name_t pname1, pname2;
code = parse_real_file_name(op, &pname2, imemory, "renamefile(to)");
if (code < 0)
return code;
pname1.fname = 0;
code = parse_real_file_name(op - 1, &pname1, imemory, "renamefile(from)");
if (code >= 0) {
gx_io_device *iodev_dflt = iodev_default(imemory);
if (pname1.iodev != pname2.iodev ) {
if (pname1.iodev == iodev_dflt)
pname1.iodev = pname2.iodev;
if (pname2.iodev == iodev_dflt)
pname2.iodev = pname1.iodev;
}
if (pname1.iodev != pname2.iodev ||
(pname1.iodev == iodev_dflt &&
/*
* We require FileControl permissions on the source path
* unless it is a temporary file. Also, we require FileControl
* and FileWriting permissions to the destination file/path.
*/
((check_file_permissions(i_ctx_p, pname1.fname, pname1.len,
pname1.iodev, "PermitFileControl") < 0 &&
!file_is_tempfile(i_ctx_p, op[-1].value.bytes, r_size(op - 1))) ||
(check_file_permissions(i_ctx_p, pname2.fname, pname2.len,
pname2.iodev, "PermitFileControl") < 0 ||
check_file_permissions(i_ctx_p, pname2.fname, pname2.len,
pname2.iodev, "PermitFileWriting") < 0 )))) {
code = gs_note_error(gs_error_invalidfileaccess);
} else {
code = (*pname1.iodev->procs.rename_file)(pname1.iodev,
pname1.fname, pname2.fname);
}
}
gs_free_file_name(&pname2, "renamefile(to)");
gs_free_file_name(&pname1, "renamefile(from)");
if (code < 0)
return code;
pop(2);
return 0;
}
| 17,976 |
151,872 | 0 | void RenderFrameHostImpl::AllowBindings(int bindings_flags) {
if (GetProcess()->IsForGuestsOnly()) {
NOTREACHED() << "Never grant bindings to a guest process.";
return;
}
TRACE_EVENT2("navigation", "RenderFrameHostImpl::AllowBindings",
"frame_tree_node", frame_tree_node_->frame_tree_node_id(),
"bindings flags", bindings_flags);
int webui_bindings = bindings_flags & kWebUIBindingsPolicyMask;
if (webui_bindings && GetProcess()->IsInitializedAndNotDead() &&
!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
GetProcess()->GetID())) {
if (GetProcess()->GetActiveViewCount() > 1 &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess))
return;
}
if (webui_bindings) {
ChildProcessSecurityPolicyImpl::GetInstance()->GrantWebUIBindings(
GetProcess()->GetID(), webui_bindings);
}
enabled_bindings_ |= bindings_flags;
if (GetParent())
DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings());
if (render_frame_created_) {
if (!frame_bindings_control_)
GetRemoteAssociatedInterfaces()->GetInterface(&frame_bindings_control_);
frame_bindings_control_->AllowBindings(enabled_bindings_);
}
}
| 17,977 |
31,323 | 0 | void crypto_put_default_rng(void)
{
mutex_lock(&crypto_default_rng_lock);
if (!--crypto_default_rng_refcnt) {
crypto_free_rng(crypto_default_rng);
crypto_default_rng = NULL;
}
mutex_unlock(&crypto_default_rng_lock);
}
| 17,978 |
145,643 | 0 | void UpdateLoadFlagsWithCacheFlags(
int* load_flags,
FrameMsg_Navigate_Type::Value navigation_type,
bool is_post) {
switch (navigation_type) {
case FrameMsg_Navigate_Type::RELOAD:
case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL:
*load_flags |= net::LOAD_VALIDATE_CACHE;
break;
case FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE:
*load_flags |= net::LOAD_BYPASS_CACHE;
break;
case FrameMsg_Navigate_Type::RESTORE:
*load_flags |= net::LOAD_SKIP_CACHE_VALIDATION;
break;
case FrameMsg_Navigate_Type::RESTORE_WITH_POST:
*load_flags |=
net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION;
break;
case FrameMsg_Navigate_Type::SAME_DOCUMENT:
case FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT:
if (is_post)
*load_flags |= net::LOAD_VALIDATE_CACHE;
break;
case FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT:
case FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT:
if (is_post) {
*load_flags |=
net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION;
} else {
*load_flags |= net::LOAD_SKIP_CACHE_VALIDATION;
}
break;
}
}
| 17,979 |
19,834 | 0 | static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,
struct inode *new_dir, struct qstr *new_name)
{
struct nfs_server *server = NFS_SERVER(old_dir);
struct nfs_renameargs arg = {
.old_dir = NFS_FH(old_dir),
.new_dir = NFS_FH(new_dir),
.old_name = old_name,
.new_name = new_name,
.bitmask = server->attr_bitmask,
};
struct nfs_renameres res = {
.server = server,
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME],
.rpc_argp = &arg,
.rpc_resp = &res,
};
int status = -ENOMEM;
res.old_fattr = nfs_alloc_fattr();
res.new_fattr = nfs_alloc_fattr();
if (res.old_fattr == NULL || res.new_fattr == NULL)
goto out;
status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
if (!status) {
update_changeattr(old_dir, &res.old_cinfo);
nfs_post_op_update_inode(old_dir, res.old_fattr);
update_changeattr(new_dir, &res.new_cinfo);
nfs_post_op_update_inode(new_dir, res.new_fattr);
}
out:
nfs_free_fattr(res.new_fattr);
nfs_free_fattr(res.old_fattr);
return status;
}
| 17,980 |
89,375 | 0 | int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
struct blk_desc **dev_desc)
{
char *ep;
char *dup_str = NULL;
const char *dev_str, *hwpart_str;
int dev, hwpart;
hwpart_str = strchr(dev_hwpart_str, '.');
if (hwpart_str) {
dup_str = strdup(dev_hwpart_str);
dup_str[hwpart_str - dev_hwpart_str] = 0;
dev_str = dup_str;
hwpart_str++;
} else {
dev_str = dev_hwpart_str;
hwpart = 0;
}
dev = simple_strtoul(dev_str, &ep, 16);
if (*ep) {
printf("** Bad device specification %s %s **\n",
ifname, dev_str);
dev = -EINVAL;
goto cleanup;
}
if (hwpart_str) {
hwpart = simple_strtoul(hwpart_str, &ep, 16);
if (*ep) {
printf("** Bad HW partition specification %s %s **\n",
ifname, hwpart_str);
dev = -EINVAL;
goto cleanup;
}
}
*dev_desc = get_dev_hwpart(ifname, dev, hwpart);
if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
debug("** Bad device %s %s **\n", ifname, dev_hwpart_str);
dev = -ENOENT;
goto cleanup;
}
#ifdef CONFIG_HAVE_BLOCK_DEVICE
/*
* Updates the partition table for the specified hw partition.
* Always should be done, otherwise hw partition 0 will return stale
* data after displaying a non-zero hw partition.
*/
part_init(*dev_desc);
#endif
cleanup:
free(dup_str);
return dev;
}
| 17,981 |
182,539 | 1 | void read_sequence_header(decoder_info_t *decoder_info, stream_t *stream) {
decoder_info->width = get_flc(16, stream);
decoder_info->height = get_flc(16, stream);
decoder_info->log2_sb_size = get_flc(3, stream);
decoder_info->pb_split = get_flc(1, stream);
decoder_info->tb_split_enable = get_flc(1, stream);
decoder_info->max_num_ref = get_flc(2, stream) + 1;
decoder_info->interp_ref = get_flc(2, stream);
decoder_info->max_delta_qp = get_flc(1, stream);
decoder_info->deblocking = get_flc(1, stream);
decoder_info->clpf = get_flc(1, stream);
decoder_info->use_block_contexts = get_flc(1, stream);
decoder_info->bipred = get_flc(2, stream);
decoder_info->qmtx = get_flc(1, stream);
if (decoder_info->qmtx) {
decoder_info->qmtx_offset = get_flc(6, stream) - 32;
}
decoder_info->subsample = get_flc(2, stream);
decoder_info->subsample = // 0: 400 1: 420 2: 422 3: 444
(decoder_info->subsample & 1) * 20 + (decoder_info->subsample & 2) * 22 +
((decoder_info->subsample & 3) == 3) * 2 + 400;
decoder_info->num_reorder_pics = get_flc(4, stream);
if (decoder_info->subsample != 400) {
decoder_info->cfl_intra = get_flc(1, stream);
decoder_info->cfl_inter = get_flc(1, stream);
}
decoder_info->bitdepth = get_flc(1, stream) ? 10 : 8;
if (decoder_info->bitdepth == 10)
decoder_info->bitdepth += 2 * get_flc(1, stream);
decoder_info->input_bitdepth = get_flc(1, stream) ? 10 : 8;
if (decoder_info->input_bitdepth == 10)
decoder_info->input_bitdepth += 2 * get_flc(1, stream);
}
| 17,982 |
52,820 | 0 | static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct ib_ucm_device *ucm_dev;
ucm_dev = container_of(dev, struct ib_ucm_device, dev);
return sprintf(buf, "%s\n", ucm_dev->ib_dev->name);
}
| 17,983 |
164,343 | 0 | ExtensionFunction::ResponseAction TabsGetSelectedFunction::Run() {
int window_id = extension_misc::kCurrentWindowId;
std::unique_ptr<tabs::GetSelected::Params> params(
tabs::GetSelected::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->window_id.get())
window_id = *params->window_id;
Browser* browser = NULL;
std::string error;
if (!GetBrowserFromWindowID(this, window_id, &browser, &error))
return RespondNow(Error(error));
TabStripModel* tab_strip = browser->tab_strip_model();
WebContents* contents = tab_strip->GetActiveWebContents();
if (!contents)
return RespondNow(Error(tabs_constants::kNoSelectedTabError));
return RespondNow(ArgumentList(
tabs::Get::Results::Create(*ExtensionTabUtil::CreateTabObject(
contents, ExtensionTabUtil::kScrubTab, extension(), tab_strip,
tab_strip->active_index()))));
}
| 17,984 |
140,226 | 0 | ScriptPromise BluetoothRemoteGATTCharacteristic::getDescriptors(
ScriptState* scriptState,
ExceptionState&) {
return getDescriptorsImpl(
scriptState, mojom::blink::WebBluetoothGATTQueryQuantity::MULTIPLE);
}
| 17,985 |
156,335 | 0 | String MediaRecorder::state() const {
return StateToString(state_);
}
| 17,986 |
46,517 | 0 | int test_mod_mul(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a,*b,*c,*d,*e;
int i,j;
a=BN_new();
b=BN_new();
c=BN_new();
d=BN_new();
e=BN_new();
for (j=0; j<3; j++) {
BN_bntest_rand(c,1024,0,0); /**/
for (i=0; i<num0; i++)
{
BN_bntest_rand(a,475+i*10,0,0); /**/
BN_bntest_rand(b,425+i*11,0,0); /**/
a->neg=rand_neg();
b->neg=rand_neg();
if (!BN_mod_mul(e,a,b,c,ctx))
{
unsigned long l;
while ((l=ERR_get_error()))
fprintf(stderr,"ERROR:%s\n",
ERR_error_string(l,NULL));
EXIT(1);
}
if (bp != NULL)
{
if (!results)
{
BN_print(bp,a);
BIO_puts(bp," * ");
BN_print(bp,b);
BIO_puts(bp," % ");
BN_print(bp,c);
if ((a->neg ^ b->neg) && !BN_is_zero(e))
{
/* If (a*b) % c is negative, c must be added
* in order to obtain the normalized remainder
* (new with OpenSSL 0.9.7, previous versions of
* BN_mod_mul could generate negative results)
*/
BIO_puts(bp," + ");
BN_print(bp,c);
}
BIO_puts(bp," - ");
}
BN_print(bp,e);
BIO_puts(bp,"\n");
}
BN_mul(d,a,b,ctx);
BN_sub(d,d,e);
BN_div(a,b,d,c,ctx);
if(!BN_is_zero(b))
{
fprintf(stderr,"Modulo multiply test failed!\n");
ERR_print_errors_fp(stderr);
return 0;
}
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return(1);
}
| 17,987 |
164,733 | 0 | void TestFillForm(const char* html, bool unowned, const char* url_override) {
static const AutofillFieldCase field_cases[] = {
{"text",
"firstname",
"",
"",
true,
"filled firstname",
"filled firstname"},
{"text", "lastname", "", "", true, "filled lastname", "filled lastname"},
{"text", "notempty", "Hi", "", false, "filled notempty", "Hi"},
{"text",
"noautocomplete",
"",
"off",
true,
"filled noautocomplete",
"filled noautocomplete"},
{"text", "notenabled", "", "", false, "filled notenabled", ""},
{"text", "readonly", "", "", false, "filled readonly", ""},
{"text", "invisible", "", "", false, "filled invisible", ""},
{"text", "displaynone", "", "", false, "filled displaynone", ""},
{"month", "month", "", "", true, "2017-11", "2017-11"},
{"month", "month-nonempty", "2011-12", "", false, "2017-11", "2011-12"},
{"select-one", "select", "", "", true, "TX", "TX"},
{"select-one", "select-nonempty", "CA", "", true, "TX", "TX"},
{"select-one", "select-unchanged", "CA", "", false, "CA", "CA"},
{"select-one", "select-displaynone", "CA", "", true, "CA", "CA"},
{"textarea",
"textarea",
"",
"",
true,
"some multi-\nline value",
"some multi-\nline value"},
{"textarea",
"textarea-nonempty",
"Go\naway!",
"",
false,
"some multi-\nline value",
"Go\naway!"},
};
TestFormFillFunctions(html, unowned, url_override, field_cases,
base::size(field_cases), FillForm, &GetValueWrapper);
WebInputElement firstname = GetInputElementById("firstname");
EXPECT_EQ(16, firstname.SelectionStart());
EXPECT_EQ(16, firstname.SelectionEnd());
}
| 17,988 |
150,807 | 0 | void WebBluetoothServiceImpl::OnStartNotifySessionSuccess(
blink::mojom::WebBluetoothCharacteristicClientAssociatedPtr client,
RemoteCharacteristicStartNotificationsCallback callback,
std::unique_ptr<device::BluetoothGattNotifySession> notify_session) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::string characteristic_instance_id =
notify_session->GetCharacteristicIdentifier();
std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS);
auto gatt_notify_session_and_client =
std::make_unique<GATTNotifySessionAndCharacteristicClient>(
std::move(notify_session), std::move(client));
characteristic_id_to_notify_session_[characteristic_instance_id] =
std::move(gatt_notify_session_and_client);
}
| 17,989 |
103,974 | 0 | GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) {
return new GLES2DecoderImpl(group);
}
| 17,990 |
57,760 | 0 | static void kvm_update_dr0123(struct kvm_vcpu *vcpu)
{
int i;
if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) {
for (i = 0; i < KVM_NR_DB_REGS; i++)
vcpu->arch.eff_db[i] = vcpu->arch.db[i];
vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD;
}
}
| 17,991 |
161,616 | 0 | void AudioHandler::Dispose() {
DCHECK(IsMainThread());
DCHECK(Context()->IsGraphOwner());
Context()->GetDeferredTaskHandler().RemoveChangedChannelCountMode(this);
Context()->GetDeferredTaskHandler().RemoveChangedChannelInterpretation(this);
Context()->GetDeferredTaskHandler().RemoveAutomaticPullNode(this);
for (auto& output : outputs_)
output->Dispose();
node_ = nullptr;
}
| 17,992 |
19,001 | 0 | void tcp4_proc_exit(void)
{
unregister_pernet_subsys(&tcp4_net_ops);
}
| 17,993 |
75,259 | 0 | static void flush_packet(vorb *f)
{
while (get8_packet_raw(f) != EOP);
}
| 17,994 |
42,945 | 0 | static void sctp_v4_pf_init(void)
{
/* Initialize the SCTP specific PF functions. */
sctp_register_pf(&sctp_pf_inet, PF_INET);
sctp_register_af(&sctp_af_inet);
}
| 17,995 |
146,434 | 0 | bool WebGLRenderingContextBase::ValidateUniformMatrixParameters(
const char* function_name,
const WebGLUniformLocation* location,
GLboolean transpose,
void* v,
GLsizei size,
GLsizei required_min_size,
GLuint src_offset,
GLuint src_length) {
DCHECK(size >= 0 && required_min_size > 0);
if (!location)
return false;
if (location->Program() != current_program_) {
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"location is not from current program");
return false;
}
if (!v) {
SynthesizeGLError(GL_INVALID_VALUE, function_name, "no array");
return false;
}
if (transpose && !IsWebGL2OrHigher()) {
SynthesizeGLError(GL_INVALID_VALUE, function_name, "transpose not FALSE");
return false;
}
if (src_offset >= static_cast<GLuint>(size)) {
SynthesizeGLError(GL_INVALID_VALUE, function_name, "invalid srcOffset");
return false;
}
GLsizei actual_size = size - src_offset;
if (src_length > 0) {
if (src_length > static_cast<GLuint>(actual_size)) {
SynthesizeGLError(GL_INVALID_VALUE, function_name,
"invalid srcOffset + srcLength");
return false;
}
actual_size = src_length;
}
if (actual_size < required_min_size || (actual_size % required_min_size)) {
SynthesizeGLError(GL_INVALID_VALUE, function_name, "invalid size");
return false;
}
return true;
}
| 17,996 |
632 | 0 | static bool ldap_decode_control_wrapper(void *mem_ctx, struct asn1_data *data,
struct ldb_control *ctrl, DATA_BLOB *value)
{
DATA_BLOB oid;
if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
return false;
}
if (!asn1_read_OctetString(data, mem_ctx, &oid)) {
return false;
}
ctrl->oid = talloc_strndup(mem_ctx, (char *)oid.data, oid.length);
if (!ctrl->oid) {
return false;
}
if (asn1_peek_tag(data, ASN1_BOOLEAN)) {
bool critical;
if (!asn1_read_BOOLEAN(data, &critical)) {
return false;
}
ctrl->critical = critical;
} else {
ctrl->critical = false;
}
ctrl->data = NULL;
if (!asn1_peek_tag(data, ASN1_OCTET_STRING)) {
*value = data_blob(NULL, 0);
goto end_tag;
}
if (!asn1_read_OctetString(data, mem_ctx, value)) {
return false;
}
end_tag:
if (!asn1_end_tag(data)) {
return false;
}
return true;
}
| 17,997 |
119,936 | 0 | bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const String& httpMethod, FrameLoadType loadType, const KURL& url)
{
ASSERT(loadType != FrameLoadTypeBackForward);
ASSERT(loadType != FrameLoadTypeReloadFromOrigin);
return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET"))
&& loadType != FrameLoadTypeReload
&& loadType != FrameLoadTypeSame
&& url.hasFragmentIdentifier()
&& equalIgnoringFragmentIdentifier(m_frame->document()->url(), url)
&& !m_frame->document()->isFrameSet();
}
| 17,998 |
64,149 | 0 | static int _server_handle_ques(libgdbr_t *g, int (*cmd_cb) (void*, const char*, char*, size_t), void *core_ptr) {
char message[64];
if (send_ack (g) < 0) {
return -1;
}
snprintf (message, sizeof (message) - 1, "T05thread:%x;", cmd_cb (core_ptr, "dptr", NULL, 0));
return send_msg (g, message);
}
| 17,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.