unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
154,840 | 0 | error::Error GLES2DecoderPassthroughImpl::DoUniform2uiv(
GLint location,
GLsizei count,
const volatile GLuint* v) {
api()->glUniform2uivFn(location, count, const_cast<const GLuint*>(v));
return error::kNoError;
}
| 9,700 |
129,045 | 0 | StateBase* writeSparseArray(uint32_t numProperties, uint32_t length, StateBase* state)
{
m_writer.writeSparseArray(numProperties, length);
return pop(state);
}
| 9,701 |
120,176 | 0 | void Layer::SetNeedsPushProperties() {
if (needs_push_properties_)
return;
if (!parent_should_know_need_push_properties() && parent_)
parent_->AddDependentNeedsPushProperties();
needs_push_properties_ = true;
}
| 9,702 |
80,879 | 0 | GF_Err tref_dump(GF_Box *a, FILE * trace)
{
gf_isom_box_dump_start(a, "TrackReferenceBox", trace);
fprintf(trace, ">\n");
gf_isom_box_dump_done("TrackReferenceBox", a, trace);
return GF_OK;
}
| 9,703 |
114,234 | 0 | bool CommandBufferProxyImpl::Send(IPC::Message* msg) {
DCHECK(last_state_.error == gpu::error::kNoError);
if (channel_) {
if (channel_->Send(msg)) {
return true;
} else {
last_state_.error = gpu::error::kLostContext;
return false;
}
}
delete msg;
return false;
}
| 9,704 |
5,462 | 0 | static void Ins_SRP2( INS_ARG )
{
CUR.GS.rp2 = (Int)(args[0]);
}
| 9,705 |
167,767 | 0 | void WebRuntimeFeatures::EnableScriptedSpeech(bool enable) {
RuntimeEnabledFeatures::SetScriptedSpeechEnabled(enable);
}
| 9,706 |
40,917 | 0 | const char *json_object_iter_key(void *iter)
{
if(!iter)
return NULL;
return hashtable_iter_key(iter);
}
| 9,707 |
21,557 | 0 | static int prctl_set_mm(int opt, unsigned long addr,
unsigned long arg4, unsigned long arg5)
{
unsigned long rlim = rlimit(RLIMIT_DATA);
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
int error;
if (arg5 || (arg4 && opt != PR_SET_MM_AUXV))
return -EINVAL;
if (!capable(CAP_SYS_RESOURCE))
return -EPERM;
if (opt == PR_SET_MM_EXE_FILE)
return prctl_set_mm_exe_file(mm, (unsigned int)addr);
if (addr >= TASK_SIZE || addr < mmap_min_addr)
return -EINVAL;
error = -EINVAL;
down_read(&mm->mmap_sem);
vma = find_vma(mm, addr);
switch (opt) {
case PR_SET_MM_START_CODE:
mm->start_code = addr;
break;
case PR_SET_MM_END_CODE:
mm->end_code = addr;
break;
case PR_SET_MM_START_DATA:
mm->start_data = addr;
break;
case PR_SET_MM_END_DATA:
mm->end_data = addr;
break;
case PR_SET_MM_START_BRK:
if (addr <= mm->end_data)
goto out;
if (rlim < RLIM_INFINITY &&
(mm->brk - addr) +
(mm->end_data - mm->start_data) > rlim)
goto out;
mm->start_brk = addr;
break;
case PR_SET_MM_BRK:
if (addr <= mm->end_data)
goto out;
if (rlim < RLIM_INFINITY &&
(addr - mm->start_brk) +
(mm->end_data - mm->start_data) > rlim)
goto out;
mm->brk = addr;
break;
/*
* If command line arguments and environment
* are placed somewhere else on stack, we can
* set them up here, ARG_START/END to setup
* command line argumets and ENV_START/END
* for environment.
*/
case PR_SET_MM_START_STACK:
case PR_SET_MM_ARG_START:
case PR_SET_MM_ARG_END:
case PR_SET_MM_ENV_START:
case PR_SET_MM_ENV_END:
if (!vma) {
error = -EFAULT;
goto out;
}
if (opt == PR_SET_MM_START_STACK)
mm->start_stack = addr;
else if (opt == PR_SET_MM_ARG_START)
mm->arg_start = addr;
else if (opt == PR_SET_MM_ARG_END)
mm->arg_end = addr;
else if (opt == PR_SET_MM_ENV_START)
mm->env_start = addr;
else if (opt == PR_SET_MM_ENV_END)
mm->env_end = addr;
break;
/*
* This doesn't move auxiliary vector itself
* since it's pinned to mm_struct, but allow
* to fill vector with new values. It's up
* to a caller to provide sane values here
* otherwise user space tools which use this
* vector might be unhappy.
*/
case PR_SET_MM_AUXV: {
unsigned long user_auxv[AT_VECTOR_SIZE];
if (arg4 > sizeof(user_auxv))
goto out;
up_read(&mm->mmap_sem);
if (copy_from_user(user_auxv, (const void __user *)addr, arg4))
return -EFAULT;
/* Make sure the last entry is always AT_NULL */
user_auxv[AT_VECTOR_SIZE - 2] = 0;
user_auxv[AT_VECTOR_SIZE - 1] = 0;
BUILD_BUG_ON(sizeof(user_auxv) != sizeof(mm->saved_auxv));
task_lock(current);
memcpy(mm->saved_auxv, user_auxv, arg4);
task_unlock(current);
return 0;
}
default:
goto out;
}
error = 0;
out:
up_read(&mm->mmap_sem);
return error;
}
| 9,708 |
135,675 | 0 | void FrameSelection::SetCaretVisible(bool caret_is_visible) {
frame_caret_->SetCaretVisibility(caret_is_visible ? CaretVisibility::kVisible
: CaretVisibility::kHidden);
}
| 9,709 |
16,264 | 0 | Condor_Auth_SSL::unwrap(char * input,
int input_len,
char*& output,
int& output_len)
{
bool result;
unsigned char* in = (unsigned char*)input;
unsigned char* out = (unsigned char*)output;
dprintf(D_SECURITY, "In unwrap.\n");
result = decrypt(in,input_len,out,output_len);
output = (char *)out;
return result ? TRUE : FALSE;
}
| 9,710 |
37,911 | 0 | static void svm_vcpu_put(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
int i;
++vcpu->stat.host_state_reload;
kvm_load_ldt(svm->host.ldt);
#ifdef CONFIG_X86_64
loadsegment(fs, svm->host.fs);
wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
load_gs_index(svm->host.gs);
#else
#ifdef CONFIG_X86_32_LAZY_GS
loadsegment(gs, svm->host.gs);
#endif
#endif
for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
}
| 9,711 |
170,484 | 0 | const char16_t* Parcel::readString16Inplace(size_t* outLen) const
{
int32_t size = readInt32();
if (size >= 0 && size < INT32_MAX) {
*outLen = size;
const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t));
if (str != NULL) {
return str;
}
}
*outLen = 0;
return NULL;
}
| 9,712 |
156,910 | 0 | bool DocumentLoader::RedirectReceived(
Resource* resource,
const ResourceRequest& request,
const ResourceResponse& redirect_response) {
DCHECK(frame_);
DCHECK_EQ(resource, GetResource());
DCHECK(!redirect_response.IsNull());
request_ = request;
const KURL& request_url = request_.Url();
scoped_refptr<const SecurityOrigin> redirecting_origin =
SecurityOrigin::Create(redirect_response.Url());
if (!redirecting_origin->CanDisplay(request_url)) {
frame_->Console().AddMessage(ConsoleMessage::Create(
kSecurityMessageSource, kErrorMessageLevel,
"Not allowed to load local resource: " + request_url.GetString()));
fetcher_->StopFetching();
return false;
}
DCHECK(!GetTiming().FetchStart().is_null());
AppendRedirect(request_url);
GetTiming().AddRedirect(redirect_response.Url(), request_url);
history_item_.Clear();
return true;
}
| 9,713 |
153,508 | 0 | ResetDraggingStateDelegate::~ResetDraggingStateDelegate() {}
| 9,714 |
96,218 | 0 | int sm_restore_priority(p_fm_config_conx_hdlt hdl, fm_mgr_type_t mgr, int argc, char *argv[]) {
fm_mgr_config_errno_t res;
fm_msg_ret_code_t ret_code;
if((res = fm_mgr_simple_query(hdl, FM_ACT_GET, FM_DT_SM_RESTORE_PRIORITY, mgr, 0, NULL, &ret_code)) != FM_CONF_OK)
{
fprintf(stderr, "sm_restore_priority: Failed to retrieve data: \n"
"\tError:(%d) %s \n\tRet code:(%d) %s\n",
res, fm_mgr_get_error_str(res),ret_code,
fm_mgr_get_resp_error_str(ret_code));
} else {
printf("sm_restore_priority: Successfully sent Relinquish Master control to local mgr instance\n");
}
return 0;
}
| 9,715 |
128,933 | 0 | void doWriteFile(const File& file)
{
doWriteWebCoreString(file.hasBackingFile() ? file.path() : "");
doWriteWebCoreString(file.name());
doWriteWebCoreString(file.webkitRelativePath());
doWriteWebCoreString(file.uuid());
doWriteWebCoreString(file.type());
if (file.hasValidSnapshotMetadata()) {
doWriteUint32(static_cast<uint8_t>(1));
long long size;
double lastModified;
file.captureSnapshot(size, lastModified);
doWriteUint64(static_cast<uint64_t>(size));
doWriteNumber(lastModified);
} else {
append(static_cast<uint8_t>(0));
}
}
| 9,716 |
53,018 | 0 | static void TraceArc(PrimitiveInfo *primitive_info,const PointInfo start,
const PointInfo end,const PointInfo degrees)
{
PointInfo
center,
radii;
center.x=0.5*(end.x+start.x);
center.y=0.5*(end.y+start.y);
radii.x=fabs(center.x-start.x);
radii.y=fabs(center.y-start.y);
TraceEllipse(primitive_info,center,radii,degrees);
}
| 9,717 |
48,947 | 0 | static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
{
if (tx_path)
return skb->ip_summed != CHECKSUM_PARTIAL;
else
return skb->ip_summed == CHECKSUM_NONE;
}
| 9,718 |
46,181 | 0 | void deactivate_super(struct super_block *s)
{
if (!atomic_add_unless(&s->s_active, -1, 1)) {
down_write(&s->s_umount);
deactivate_locked_super(s);
}
}
| 9,719 |
120,459 | 0 | void Element::blur()
{
cancelFocusAppearanceUpdate();
Document* doc = document();
if (treeScope()->focusedNode() == this) {
if (doc->frame())
doc->frame()->page()->focusController()->setFocusedNode(0, doc->frame());
else
doc->setFocusedNode(0);
}
}
| 9,720 |
67,056 | 0 | static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
{
AVFrame *tmp;
int ret;
av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
if (frame->data[0] && (frame->width != avctx->width || frame->height != avctx->height || frame->format != avctx->pix_fmt)) {
av_log(avctx, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
frame->width, frame->height, av_get_pix_fmt_name(frame->format), avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
av_frame_unref(frame);
}
ff_init_buffer_info(avctx, frame);
if (!frame->data[0])
return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
if (av_frame_is_writable(frame))
return ff_decode_frame_props(avctx, frame);
tmp = av_frame_alloc();
if (!tmp)
return AVERROR(ENOMEM);
av_frame_move_ref(tmp, frame);
ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
if (ret < 0) {
av_frame_free(&tmp);
return ret;
}
av_frame_copy(frame, tmp);
av_frame_free(&tmp);
return 0;
}
| 9,721 |
158,884 | 0 | base::string16 GetSecondPageTitle() {
return ASCIIToUTF16(kSecondPageTitle);
}
| 9,722 |
152,065 | 0 | void RenderFrameHostImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback,
ui::AXMode ax_mode) {
static int next_id = 1;
int callback_id = next_id++;
Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id,
ax_mode.mode()));
ax_tree_snapshot_callbacks_.emplace(callback_id, std::move(callback));
}
| 9,723 |
37,148 | 0 | static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr)
{
struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
if (!(vmcs12->exception_bitmap & (1u << nr)))
return 0;
nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason,
vmcs_read32(VM_EXIT_INTR_INFO),
vmcs_readl(EXIT_QUALIFICATION));
return 1;
}
| 9,724 |
31,191 | 0 | static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
{
return -ENOSYS;
}
| 9,725 |
2,349 | 0 | const char *ldb_dn_get_linearized(struct ldb_dn *dn)
{
unsigned int i;
size_t len;
char *d, *n;
if ( ! dn || ( dn->invalid)) return NULL;
if (dn->linearized) return dn->linearized;
if ( ! dn->components) {
ldb_dn_mark_invalid(dn);
return NULL;
}
if (dn->comp_num == 0) {
dn->linearized = talloc_strdup(dn, "");
if ( ! dn->linearized) return NULL;
return dn->linearized;
}
/* calculate maximum possible length of DN */
for (len = 0, i = 0; i < dn->comp_num; i++) {
/* name len */
len += strlen(dn->components[i].name);
/* max escaped data len */
len += (dn->components[i].value.length * 3);
len += 2; /* '=' and ',' */
}
dn->linearized = talloc_array(dn, char, len);
if ( ! dn->linearized) return NULL;
d = dn->linearized;
for (i = 0; i < dn->comp_num; i++) {
/* copy the name */
n = dn->components[i].name;
while (*n) *d++ = *n++;
*d++ = '=';
/* and the value */
d += ldb_dn_escape_internal( d,
(char *)dn->components[i].value.data,
dn->components[i].value.length);
*d++ = ',';
}
*(--d) = '\0';
/* don't waste more memory than necessary */
dn->linearized = talloc_realloc(dn, dn->linearized,
char, (d - dn->linearized + 1));
return dn->linearized;
}
| 9,726 |
98,892 | 0 | const std::vector<WebSocketEvent>& GetSeenEvents() const {
return events_;
}
| 9,727 |
158,642 | 0 | void Trace(blink::Visitor* visitor) {
visitor->Trace(content_security_policy);
}
| 9,728 |
187,726 | 1 | store_image_check(PNG_CONST png_store* ps, png_const_structp pp, int iImage)
{
png_const_bytep image = ps->image;
if (image[-1] != 0xed || image[ps->cb_image] != 0xfe)
png_error(pp, "image overwrite");
else
{
png_size_t cbRow = ps->cb_row;
png_uint_32 rows = ps->image_h;
image += iImage * (cbRow+5) * ps->image_h;
image += 2; /* skip image first row markers */
while (rows-- > 0)
{
if (image[-2] != 190 || image[-1] != 239)
png_error(pp, "row start overwritten");
if (image[cbRow] != 222 || image[cbRow+1] != 173 ||
image[cbRow+2] != 17)
png_error(pp, "row end overwritten");
image += cbRow+5;
}
}
}
| 9,729 |
8,522 | 0 | static int s_write(Ssh ssh, void *data, int len)
{
if (ssh->logctx)
log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len,
0, NULL, NULL, 0, NULL);
if (!ssh->s)
return 0;
return sk_write(ssh->s, (char *)data, len);
}
| 9,730 |
45,881 | 0 | static void pcrypt_fini_padata(struct padata_pcrypt *pcrypt)
{
free_cpumask_var(pcrypt->cb_cpumask->mask);
kfree(pcrypt->cb_cpumask);
padata_stop(pcrypt->pinst);
padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock);
destroy_workqueue(pcrypt->wq);
padata_free(pcrypt->pinst);
}
| 9,731 |
145,985 | 0 | ToplevelWindowEventHandlerTest() {}
| 9,732 |
73,198 | 0 | static int file_close(jas_stream_obj_t *obj)
{
jas_stream_fileobj_t *fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
int ret;
ret = close(fileobj->fd);
if (fileobj->flags & JAS_STREAM_FILEOBJ_DELONCLOSE) {
unlink(fileobj->pathname);
}
jas_free(fileobj);
return ret;
}
| 9,733 |
188,172 | 1 | void close_all_sockets(atransport* t) {
asocket* s;
/* this is a little gross, but since s->close() *will* modify
** the list out from under you, your options are limited.
*/
adb_mutex_lock(&socket_list_lock);
restart:
for (s = local_socket_list.next; s != &local_socket_list; s = s->next) {
if (s->transport == t || (s->peer && s->peer->transport == t)) {
local_socket_close_locked(s);
goto restart;
}
}
adb_mutex_unlock(&socket_list_lock);
}
| 9,734 |
101,012 | 0 | DumpOriginInfoTableTask(
QuotaManager* manager,
Callback* callback)
: DatabaseTaskBase(manager),
callback_(callback) {
}
| 9,735 |
145,115 | 0 | ~AutoInstallCurrentThreadPlatformMock()
{
Platform::initialize(m_oldPlatform);
}
| 9,736 |
176,127 | 0 | VOID ixheaacd_esbr_postradixcompute4(WORD32 *ptr_y, WORD32 *ptr_x,
const WORD32 *p_dig_rev_tbl,
WORD32 npoints) {
WORD32 i, k;
WORD32 h2;
WORD32 xh0_0, xh1_0, xl0_0, xl1_0;
WORD32 xh0_1, xh1_1, xl0_1, xl1_1;
WORD32 x_0, x_1, x_2, x_3;
WORD32 xh0_2, xh1_2, xl0_2, xl1_2, xh0_3, xh1_3, xl0_3, xl1_3;
WORD32 x_4, x_5, x_6, x_7;
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
y0 = ptr_y;
y2 = ptr_y + (WORD32)npoints;
x0 = ptr_x;
x2 = ptr_x + (WORD32)(npoints >> 1);
y1 = y0 + (WORD32)(npoints >> 1);
y3 = y2 + (WORD32)(npoints >> 1);
j0 = 4;
n0 = npoints >> 2;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
h2 = *p_dig_rev_tbl++ >> 2;
x_0 = *x0++;
x_1 = *x0++;
x_2 = *x0++;
x_3 = *x0++;
x_4 = *x0++;
x_5 = *x0++;
x_6 = *x0++;
x_7 = *x0++;
xh0_0 = x_0 + x_4;
xh1_0 = x_1 + x_5;
xl0_0 = x_0 - x_4;
xl1_0 = x_1 - x_5;
xh0_1 = x_2 + x_6;
xh1_1 = x_3 + x_7;
xl0_1 = x_2 - x_6;
xl1_1 = x_3 - x_7;
n00 = xh0_0 + xh0_1;
n01 = xh1_0 + xh1_1;
n10 = xl0_0 + xl1_1;
n11 = xl1_0 - xl0_1;
n20 = xh0_0 - xh0_1;
n21 = xh1_0 - xh1_1;
n30 = xl0_0 - xl1_1;
n31 = xl1_0 + xl0_1;
y0[h2] = n00;
y0[h2 + 1] = n01;
y1[h2] = n10;
y1[h2 + 1] = n11;
y2[h2] = n20;
y2[h2 + 1] = n21;
y3[h2] = n30;
y3[h2 + 1] = n31;
x_8 = *x2++;
x_9 = *x2++;
x_a = *x2++;
x_b = *x2++;
x_c = *x2++;
x_d = *x2++;
x_e = *x2++;
x_f = *x2++;
xh0_2 = x_8 + x_c;
xh1_2 = x_9 + x_d;
xl0_2 = x_8 - x_c;
xl1_2 = x_9 - x_d;
xh0_3 = x_a + x_e;
xh1_3 = x_b + x_f;
xl0_3 = x_a - x_e;
xl1_3 = x_b - x_f;
n02 = xh0_2 + xh0_3;
n03 = xh1_2 + xh1_3;
n12 = xl0_2 + xl1_3;
n13 = xl1_2 - xl0_3;
n22 = xh0_2 - xh0_3;
n23 = xh1_2 - xh1_3;
n32 = xl0_2 - xl1_3;
n33 = xl1_2 + xl0_3;
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
y1[h2 + 2] = n12;
y1[h2 + 3] = n13;
y2[h2 + 2] = n22;
y2[h2 + 3] = n23;
y3[h2 + 2] = n32;
y3[h2 + 3] = n33;
}
x0 += (WORD32)npoints >> 1;
x2 += (WORD32)npoints >> 1;
}
}
| 9,737 |
181,543 | 1 | static void skel(const char *homedir, uid_t u, gid_t g) {
char *fname;
// zsh
if (!arg_shell_none && (strcmp(cfg.shell,"/usr/bin/zsh") == 0 || strcmp(cfg.shell,"/bin/zsh") == 0)) {
// copy skel files
if (asprintf(&fname, "%s/.zshrc", homedir) == -1)
errExit("asprintf");
struct stat s;
// don't copy it if we already have the file
if (stat(fname, &s) == 0)
return;
if (stat("/etc/skel/.zshrc", &s) == 0) {
copy_file("/etc/skel/.zshrc", fname, u, g, 0644);
fs_logger("clone /etc/skel/.zshrc");
}
else {
touch_file_as_user(fname, u, g, 0644);
fs_logger2("touch", fname);
}
free(fname);
}
// csh
else if (!arg_shell_none && strcmp(cfg.shell,"/bin/csh") == 0) {
// copy skel files
if (asprintf(&fname, "%s/.cshrc", homedir) == -1)
errExit("asprintf");
struct stat s;
// don't copy it if we already have the file
if (stat(fname, &s) == 0)
return;
if (stat("/etc/skel/.cshrc", &s) == 0) {
copy_file("/etc/skel/.cshrc", fname, u, g, 0644);
fs_logger("clone /etc/skel/.cshrc");
}
else {
touch_file_as_user(fname, u, g, 0644);
fs_logger2("touch", fname);
}
free(fname);
}
// bash etc.
else {
// copy skel files
if (asprintf(&fname, "%s/.bashrc", homedir) == -1)
errExit("asprintf");
struct stat s;
// don't copy it if we already have the file
if (stat(fname, &s) == 0)
return;
if (stat("/etc/skel/.bashrc", &s) == 0) {
copy_file("/etc/skel/.bashrc", fname, u, g, 0644);
fs_logger("clone /etc/skel/.bashrc");
}
free(fname);
}
}
| 9,738 |
100,953 | 0 | void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer)
{
BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer);
if (!surface) {
GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0))
data().projectionMatrix = createProjectionMatrix(viewportSize(), true).multiply(transform());
GL_CMD(glStencilFunc(data().globalGLData.stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().globalGLData.stencilIndex - 1, data().globalGLData.stencilIndex - 1))
GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP))
GL_CMD(glViewport(0, 0, viewportSize().width(), viewportSize().height()))
return;
}
surface->bind();
}
| 9,739 |
41,402 | 0 | int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
struct kvm_dirty_log *log)
{
int r, i;
struct kvm_memory_slot *memslot;
unsigned long n;
unsigned long is_dirty = 0;
mutex_lock(&kvm->slots_lock);
r = -EINVAL;
if (log->slot >= KVM_MEMORY_SLOTS)
goto out;
memslot = &kvm->memslots->memslots[log->slot];
r = -ENOENT;
if (!memslot->dirty_bitmap)
goto out;
n = kvm_dirty_bitmap_bytes(memslot);
for (i = 0; !is_dirty && i < n/sizeof(long); i++)
is_dirty = memslot->dirty_bitmap[i];
/* If nothing is dirty, don't bother messing with page tables. */
if (is_dirty) {
struct kvm_memslots *slots, *old_slots;
unsigned long *dirty_bitmap;
dirty_bitmap = memslot->dirty_bitmap_head;
if (memslot->dirty_bitmap == dirty_bitmap)
dirty_bitmap += n / sizeof(long);
memset(dirty_bitmap, 0, n);
r = -ENOMEM;
slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);
if (!slots)
goto out;
memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots));
slots->memslots[log->slot].dirty_bitmap = dirty_bitmap;
slots->generation++;
old_slots = kvm->memslots;
rcu_assign_pointer(kvm->memslots, slots);
synchronize_srcu_expedited(&kvm->srcu);
dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap;
kfree(old_slots);
spin_lock(&kvm->mmu_lock);
kvm_mmu_slot_remove_write_access(kvm, log->slot);
spin_unlock(&kvm->mmu_lock);
r = -EFAULT;
if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n))
goto out;
} else {
r = -EFAULT;
if (clear_user(log->dirty_bitmap, n))
goto out;
}
r = 0;
out:
mutex_unlock(&kvm->slots_lock);
return r;
}
| 9,740 |
6,315 | 0 | static HashTable *date_object_get_properties_timezone(zval *object TSRMLS_DC)
{
HashTable *props;
zval *zv;
php_timezone_obj *tzobj;
tzobj = (php_timezone_obj *) zend_object_store_get_object(object TSRMLS_CC);
props = zend_std_get_properties(object TSRMLS_CC);
if (!tzobj->initialized) {
return props;
}
MAKE_STD_ZVAL(zv);
ZVAL_LONG(zv, tzobj->type);
zend_hash_update(props, "timezone_type", 14, &zv, sizeof(zv), NULL);
MAKE_STD_ZVAL(zv);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
ZVAL_STRING(zv, tzobj->tzi.tz->name, 1);
break;
case TIMELIB_ZONETYPE_OFFSET: {
char *tmpstr = emalloc(sizeof("UTC+05:00"));
snprintf(tmpstr, sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset > 0 ? '-' : '+',
abs(tzobj->tzi.utc_offset / 60),
abs((tzobj->tzi.utc_offset % 60)));
ZVAL_STRING(zv, tmpstr, 0);
}
break;
case TIMELIB_ZONETYPE_ABBR:
ZVAL_STRING(zv, tzobj->tzi.z.abbr, 1);
break;
}
zend_hash_update(props, "timezone", 9, &zv, sizeof(zv), NULL);
return props;
}
| 9,741 |
76,348 | 0 | static void __mark_reg_const_zero(struct bpf_reg_state *reg)
{
__mark_reg_known(reg, 0);
reg->off = 0;
reg->type = SCALAR_VALUE;
}
| 9,742 |
69,314 | 0 | const EVP_CIPHER *EVP_aes_256_wrap_pad(void)
{
return &aes_256_wrap_pad;
}
| 9,743 |
127,257 | 0 | void WtsSessionProcessDelegate::Core::InitializeJobCompleted(
scoped_ptr<ScopedHandle> job) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
DCHECK(!job_.IsValid());
job_ = job->Pass();
}
| 9,744 |
181,287 | 1 | static void iwjpeg_scan_exif(struct iwjpegrcontext *rctx,
const iw_byte *d, size_t d_len)
{
struct iw_exif_state e;
iw_uint32 ifd;
if(d_len<8) return;
iw_zeromem(&e,sizeof(struct iw_exif_state));
e.d = d;
e.d_len = d_len;
e.endian = d[0]=='I' ? IW_ENDIAN_LITTLE : IW_ENDIAN_BIG;
ifd = iw_get_ui32_e(&d[4],e.endian);
iwjpeg_scan_exif_ifd(rctx,&e,ifd);
}
| 9,745 |
58,259 | 0 | static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
gfp_t gfp, pgprot_t prot, bool is_coherent, const void *caller)
{
u64 mask = get_coherent_dma_mask(dev);
struct page *page = NULL;
void *addr;
#ifdef CONFIG_DMA_API_DEBUG
u64 limit = (mask + 1) & ~mask;
if (limit && size >= limit) {
dev_warn(dev, "coherent allocation too big (requested %#x mask %#llx)\n",
size, mask);
return NULL;
}
#endif
if (!mask)
return NULL;
if (mask < 0xffffffffULL)
gfp |= GFP_DMA;
/*
* Following is a work-around (a.k.a. hack) to prevent pages
* with __GFP_COMP being passed to split_page() which cannot
* handle them. The real problem is that this flag probably
* should be 0 on ARM as it is not supported on this
* platform; see CONFIG_HUGETLBFS.
*/
gfp &= ~(__GFP_COMP);
*handle = DMA_ERROR_CODE;
size = PAGE_ALIGN(size);
if (is_coherent || nommu())
addr = __alloc_simple_buffer(dev, size, gfp, &page);
else if (!(gfp & __GFP_WAIT))
addr = __alloc_from_pool(size, &page);
else if (!IS_ENABLED(CONFIG_DMA_CMA))
addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
else
addr = __alloc_from_contiguous(dev, size, prot, &page, caller);
if (addr)
*handle = pfn_to_dma(dev, page_to_pfn(page));
return addr;
}
| 9,746 |
39,703 | 0 | static int open_will_truncate(int flag, struct inode *inode)
{
/*
* We'll never write to the fs underlying
* a device file.
*/
if (special_file(inode->i_mode))
return 0;
return (flag & O_TRUNC);
}
| 9,747 |
39,478 | 0 | static int yam_set_mac_address(struct net_device *dev, void *addr)
{
struct sockaddr *sa = (struct sockaddr *) addr;
/* addr is an AX.25 shifted ASCII mac address */
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
return 0;
}
| 9,748 |
50,015 | 0 | archive_read_data_skip(struct archive *_a)
{
struct archive_read *a = (struct archive_read *)_a;
int r;
const void *buff;
size_t size;
int64_t offset;
archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA,
"archive_read_data_skip");
if (a->format->read_data_skip != NULL)
r = (a->format->read_data_skip)(a);
else {
while ((r = archive_read_data_block(&a->archive,
&buff, &size, &offset))
== ARCHIVE_OK)
;
}
if (r == ARCHIVE_EOF)
r = ARCHIVE_OK;
a->archive.state = ARCHIVE_STATE_HEADER;
return (r);
}
| 9,749 |
25,285 | 0 | static const struct arm_pmu *__init xscale1pmu_init(void)
{
return NULL;
}
| 9,750 |
31,916 | 0 | list_add_event(struct perf_event *event, struct perf_event_context *ctx)
{
WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);
event->attach_state |= PERF_ATTACH_CONTEXT;
/*
* If we're a stand alone event or group leader, we go to the context
* list, group events are kept attached to the group so that
* perf_group_detach can, at all times, locate all siblings.
*/
if (event->group_leader == event) {
struct list_head *list;
if (is_software_event(event))
event->group_flags |= PERF_GROUP_SOFTWARE;
list = ctx_group_list(event, ctx);
list_add_tail(&event->group_entry, list);
}
if (is_cgroup_event(event))
ctx->nr_cgroups++;
if (has_branch_stack(event))
ctx->nr_branch_stack++;
list_add_rcu(&event->event_entry, &ctx->event_list);
if (!ctx->nr_events)
perf_pmu_rotate_start(ctx->pmu);
ctx->nr_events++;
if (event->attr.inherit_stat)
ctx->nr_stat++;
}
| 9,751 |
121,470 | 0 | DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow(
content::RenderViewHost* inspected_rvh,
bool force_open,
const DevToolsToggleAction& action) {
scoped_refptr<DevToolsAgentHost> agent(
DevToolsAgentHost::GetOrCreateFor(inspected_rvh));
content::DevToolsManager* manager = content::DevToolsManager::GetInstance();
DevToolsWindow* window = FindDevToolsWindow(agent.get());
bool do_open = force_open;
if (!window) {
Profile* profile = Profile::FromBrowserContext(
inspected_rvh->GetProcess()->GetBrowserContext());
DevToolsDockSide dock_side = GetDockSideFromPrefs(profile);
content::RecordAction(
content::UserMetricsAction("DevTools_InspectRenderer"));
window = Create(profile, GURL(), inspected_rvh, dock_side, false, false);
manager->RegisterDevToolsClientHostFor(agent.get(),
window->frontend_host_.get());
do_open = true;
}
window->UpdateBrowserToolbar();
if (window->dock_side_ == DEVTOOLS_DOCK_SIDE_MINIMIZED)
window->Restore();
else if (!window->IsDocked() || do_open)
window->Show(action);
else
window->CloseWindow();
return window;
}
| 9,752 |
24,337 | 0 | static int ieee80211_stop(struct net_device *dev)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
ieee80211_do_stop(sdata, true);
return 0;
}
| 9,753 |
153,310 | 0 | int XI2ModeToXMode(int xi2_mode) {
switch (xi2_mode) {
case XINotifyNormal:
return NotifyNormal;
case XINotifyGrab:
case XINotifyPassiveGrab:
return NotifyGrab;
case XINotifyUngrab:
case XINotifyPassiveUngrab:
return NotifyUngrab;
case XINotifyWhileGrabbed:
return NotifyWhileGrabbed;
default:
NOTREACHED();
return NotifyNormal;
}
}
| 9,754 |
38,617 | 0 | void do_break (struct pt_regs *regs, unsigned long address,
unsigned long error_code)
{
siginfo_t info;
current->thread.trap_nr = TRAP_HWBKPT;
if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
11, SIGSEGV) == NOTIFY_STOP)
return;
if (debugger_break_match(regs))
return;
/* Clear the breakpoint */
hw_breakpoint_disable();
/* Deliver the signal to userspace */
info.si_signo = SIGTRAP;
info.si_errno = 0;
info.si_code = TRAP_HWBKPT;
info.si_addr = (void __user *)address;
force_sig_info(SIGTRAP, &info, current);
}
| 9,755 |
73,029 | 0 | BGD_DECLARE(int) gdAlphaBlend (int dst, int src)
{
int src_alpha = gdTrueColorGetAlpha(src);
int dst_alpha, alpha, red, green, blue;
int src_weight, dst_weight, tot_weight;
/* -------------------------------------------------------------------- */
/* Simple cases we want to handle fast. */
/* -------------------------------------------------------------------- */
if( src_alpha == gdAlphaOpaque )
return src;
dst_alpha = gdTrueColorGetAlpha(dst);
if( src_alpha == gdAlphaTransparent )
return dst;
if( dst_alpha == gdAlphaTransparent )
return src;
/* -------------------------------------------------------------------- */
/* What will the source and destination alphas be? Note that */
/* the destination weighting is substantially reduced as the */
/* overlay becomes quite opaque. */
/* -------------------------------------------------------------------- */
src_weight = gdAlphaTransparent - src_alpha;
dst_weight = (gdAlphaTransparent - dst_alpha) * src_alpha / gdAlphaMax;
tot_weight = src_weight + dst_weight;
/* -------------------------------------------------------------------- */
/* What red, green and blue result values will we use? */
/* -------------------------------------------------------------------- */
alpha = src_alpha * dst_alpha / gdAlphaMax;
red = (gdTrueColorGetRed(src) * src_weight
+ gdTrueColorGetRed(dst) * dst_weight) / tot_weight;
green = (gdTrueColorGetGreen(src) * src_weight
+ gdTrueColorGetGreen(dst) * dst_weight) / tot_weight;
blue = (gdTrueColorGetBlue(src) * src_weight
+ gdTrueColorGetBlue(dst) * dst_weight) / tot_weight;
/* -------------------------------------------------------------------- */
/* Return merged result. */
/* -------------------------------------------------------------------- */
return ((alpha << 24) + (red << 16) + (green << 8) + blue);
}
| 9,756 |
77,151 | 0 | OVS_REQUIRES(ofproto_mutex)
{
enum ofperr error;
error = ofproto_check_ofpacts(ofproto, opo->ofpacts, opo->ofpacts_len);
if (error) {
return error;
}
return ofproto->ofproto_class->packet_xlate(ofproto, opo);
}
| 9,757 |
39,519 | 0 | fst_intr_ctlchg(struct fst_card_info *card, struct fst_port_info *port)
{
int signals;
signals = FST_RDL(card, v24DebouncedSts[port->index]);
if (signals & (((port->hwif == X21) || (port->hwif == X21D))
? IPSTS_INDICATE : IPSTS_DCD)) {
if (!netif_carrier_ok(port_to_dev(port))) {
dbg(DBG_INTR, "DCD active\n");
netif_carrier_on(port_to_dev(port));
}
} else {
if (netif_carrier_ok(port_to_dev(port))) {
dbg(DBG_INTR, "DCD lost\n");
netif_carrier_off(port_to_dev(port));
}
}
}
| 9,758 |
134,267 | 0 | bool OmniboxViewViews::IsImeShowingPopup() const {
#if defined(OS_CHROMEOS)
return ime_candidate_window_open_;
#else
const views::InputMethod* input_method = this->GetInputMethod();
return input_method && input_method->IsCandidatePopupOpen();
#endif
}
| 9,759 |
147,609 | 0 | static void OriginTrialEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueInt(info, impl->originTrialEnabledLongAttribute());
}
| 9,760 |
83,129 | 0 | fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet)
{
int saved_errno = 0;
if (fptr == NULL) {
return;
}
if (fptr->fd > 2) {
#ifdef _WIN32
if (fptr->is_socket) {
if (closesocket(fptr->fd) != 0) {
saved_errno = WSAGetLastError();
}
fptr->fd = -1;
}
#endif
if (fptr->fd != -1) {
if (close(fptr->fd) == -1) {
saved_errno = errno;
}
}
fptr->fd = -1;
}
if (fptr->fd2 > 2) {
if (close(fptr->fd2) == -1) {
if (saved_errno == 0) {
saved_errno = errno;
}
}
fptr->fd2 = -1;
}
if (fptr->pid != 0) {
#if !defined(_WIN32) && !defined(_WIN64)
pid_t pid;
int status;
do {
pid = waitpid(fptr->pid, &status, 0);
} while (pid == -1 && errno == EINTR);
if (!quiet && pid == fptr->pid) {
io_set_process_status(mrb, pid, status);
}
#else
HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, fptr->pid);
DWORD status;
if (WaitForSingleObject(h, INFINITE) && GetExitCodeProcess(h, &status))
if (!quiet)
io_set_process_status(mrb, fptr->pid, (int)status);
CloseHandle(h);
#endif
fptr->pid = 0;
/* Note: we don't raise an exception when waitpid(3) fails */
}
if (!quiet && saved_errno != 0) {
errno = saved_errno;
mrb_sys_fail(mrb, "fptr_finalize failed.");
}
}
| 9,761 |
158,109 | 0 | Frame* LocalFrameClientImpl::Opener() const {
return ToCoreFrame(web_frame_->Opener());
}
| 9,762 |
111,011 | 0 | void FileSystemOperation::DidTouchFile(const StatusCallback& callback,
base::PlatformFileError rv) {
callback.Run(rv);
}
| 9,763 |
179,779 | 1 | static void __net_exit sctp_net_exit(struct net *net)
{
/* Free the local address list */
sctp_free_addr_wq(net);
sctp_free_local_addr_list(net);
/* Free the control endpoint. *
inet_ctl_sock_destroy(net->sctp.ctl_sock);
sctp_dbg_objcnt_exit(net);
sctp_proc_exit(net);
cleanup_sctp_mibs(net);
sctp_sysctl_net_unregister(net);
}
| 9,764 |
163,974 | 0 | bool PaymentRequestState::IsInitialized() const {
return get_all_instruments_finished_;
}
| 9,765 |
127,369 | 0 | bool StyleResolver::checkRegionStyle(Element* regionElement)
{
if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument()) {
if (scopedResolver->checkRegionStyle(regionElement))
return true;
}
return false;
}
| 9,766 |
94,909 | 0 | int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size)
{
int ret;
if (usb_autopm_get_interface(dev->intf) < 0)
return -ENODEV;
ret = __usbnet_read_cmd(dev, cmd, reqtype, value, index,
data, size);
usb_autopm_put_interface(dev->intf);
return ret;
}
| 9,767 |
115,274 | 0 | void OmniboxViewWin::RepaintDropHighlight(int position) {
if ((position != -1) && (position <= GetTextLength())) {
const POINT min_loc(PosFromChar(position));
const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_,
min_loc.x + 2, font_.GetHeight() + font_y_adjustment_};
InvalidateRect(&highlight_bounds, false);
}
}
| 9,768 |
176,289 | 0 | static uint32_t GetMaxNumberOfEntries(JSObject* receiver,
FixedArrayBase* elements) {
return Subclass::GetMaxIndex(receiver, elements);
}
| 9,769 |
169,811 | 0 | exsltFuncNewFunctionData (void) {
exsltFuncFunctionData *ret;
ret = (exsltFuncFunctionData *) xmlMalloc (sizeof(exsltFuncFunctionData));
if (ret == NULL) {
xsltGenericError(xsltGenericErrorContext,
"exsltFuncNewFunctionData: not enough memory\n");
return (NULL);
}
memset(ret, 0, sizeof(exsltFuncFunctionData));
ret->nargs = 0;
ret->content = NULL;
return(ret);
}
| 9,770 |
102,053 | 0 | void SyncBackendHost::EnableEncryptEverything() {
sync_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(),
&SyncBackendHost::Core::DoEnableEncryptEverything));
}
| 9,771 |
159,487 | 0 | void Pack<WebGLImageConversion::kDataFormatRGBA4444,
WebGLImageConversion::kAlphaDoUnmultiply,
uint8_t,
uint16_t>(const uint8_t* source,
uint16_t* destination,
unsigned pixels_per_row) {
for (unsigned i = 0; i < pixels_per_row; ++i) {
float scale_factor = source[3] ? 255.0f / source[3] : 1.0f;
uint8_t source_r =
static_cast<uint8_t>(static_cast<float>(source[0]) * scale_factor);
uint8_t source_g =
static_cast<uint8_t>(static_cast<float>(source[1]) * scale_factor);
uint8_t source_b =
static_cast<uint8_t>(static_cast<float>(source[2]) * scale_factor);
*destination = (((source_r & 0xF0) << 8) | ((source_g & 0xF0) << 4) |
(source_b & 0xF0) | (source[3] >> 4));
source += 4;
destination += 1;
}
}
| 9,772 |
158,416 | 0 | void InitializeAura() {
view_->InitAsChild(nullptr);
view_->Show();
}
| 9,773 |
9,357 | 0 | int ossl_statem_in_error(const SSL *s)
{
if (s->statem.state == MSG_FLOW_ERROR)
return 1;
return 0;
}
| 9,774 |
53,337 | 0 | static void error_set(json_error_t *error, const lex_t *lex,
const char *msg, ...)
{
va_list ap;
char msg_text[JSON_ERROR_TEXT_LENGTH];
char msg_with_context[JSON_ERROR_TEXT_LENGTH];
int line = -1, col = -1;
size_t pos = 0;
const char *result = msg_text;
if(!error)
return;
va_start(ap, msg);
vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap);
msg_text[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
va_end(ap);
if(lex)
{
const char *saved_text = strbuffer_value(&lex->saved_text);
line = lex->stream.line;
col = lex->stream.column;
pos = lex->stream.position;
if(saved_text && saved_text[0])
{
if(lex->saved_text.length <= 20) {
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH,
"%s near '%s'", msg_text, saved_text);
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
result = msg_with_context;
}
}
else
{
if(lex->stream.state == STREAM_STATE_ERROR) {
/* No context for UTF-8 decoding errors */
result = msg_text;
}
else {
snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH,
"%s near end of file", msg_text);
msg_with_context[JSON_ERROR_TEXT_LENGTH - 1] = '\0';
result = msg_with_context;
}
}
}
jsonp_error_set(error, line, col, pos, "%s", result);
}
| 9,775 |
78,819 | 0 | unsigned short bebytes2ushort(const u8 *buf)
{
if (buf == NULL)
return 0U;
return (unsigned short) (buf[0] << 8 | buf[1]);
}
| 9,776 |
3,025 | 0 | void vga_sync_dirty_bitmap(VGACommonState *s)
{
memory_region_sync_dirty_bitmap(&s->vram);
}
| 9,777 |
160,121 | 0 | void BackendIO::DoomAllEntries() {
operation_ = OP_DOOM_ALL;
}
| 9,778 |
58,512 | 0 | void credssp_buffer_print(rdpCredssp* credssp)
{
if (credssp->negoToken.cbBuffer > 0)
{
fprintf(stderr, "CredSSP.negoToken (length = %d):\n", (int) credssp->negoToken.cbBuffer);
winpr_HexDump(credssp->negoToken.pvBuffer, credssp->negoToken.cbBuffer);
}
if (credssp->pubKeyAuth.cbBuffer > 0)
{
fprintf(stderr, "CredSSP.pubKeyAuth (length = %d):\n", (int) credssp->pubKeyAuth.cbBuffer);
winpr_HexDump(credssp->pubKeyAuth.pvBuffer, credssp->pubKeyAuth.cbBuffer);
}
if (credssp->authInfo.cbBuffer > 0)
{
fprintf(stderr, "CredSSP.authInfo (length = %d):\n", (int) credssp->authInfo.cbBuffer);
winpr_HexDump(credssp->authInfo.pvBuffer, credssp->authInfo.cbBuffer);
}
}
| 9,779 |
121,013 | 0 | scoped_refptr<SSLSocketParams> GetSslParams() {
if (GetParam() == HTTP)
return scoped_refptr<SSLSocketParams>();
return ignored_ssl_socket_params_;
}
| 9,780 |
77,906 | 0 | test_bson_concat (void)
{
bson_t a = BSON_INITIALIZER;
bson_t b = BSON_INITIALIZER;
bson_t c = BSON_INITIALIZER;
bson_append_int32 (&a, "abc", 3, 1);
bson_append_int32 (&b, "def", 3, 1);
bson_concat (&a, &b);
bson_append_int32 (&c, "abc", 3, 1);
bson_append_int32 (&c, "def", 3, 1);
BSON_ASSERT (0 == bson_compare (&c, &a));
bson_destroy (&a);
bson_destroy (&b);
bson_destroy (&c);
}
| 9,781 |
159,531 | 0 | void Pack<WebGLImageConversion::kDataFormatRG32F,
WebGLImageConversion::kAlphaDoNothing,
float,
float>(const float* source,
float* destination,
unsigned pixels_per_row) {
for (unsigned i = 0; i < pixels_per_row; ++i) {
destination[0] = source[0];
destination[1] = source[1];
source += 4;
destination += 2;
}
}
| 9,782 |
82,780 | 0 | static int avr_custom_spm_page_fill(RAnalEsil *esil) {
CPU_MODEL *cpu;
ut64 addr, page_size_bits, i;
ut8 r0, r1;
if (!esil || !esil->anal || !esil->anal->reg) {
return false;
}
if (!__esil_pop_argument(esil, &addr)) {
return false;
}
if (!__esil_pop_argument (esil, &i)) {
return false;
}
r0 = i;
if (!__esil_pop_argument (esil, &i)) {
return false;
}
r1 = i;
cpu = get_cpu_model (esil->anal->cpu);
page_size_bits = const_get_value (const_by_name (cpu, CPU_CONST_PARAM, "page_size"));
addr &= (MASK (page_size_bits) ^ 1);
r_anal_esil_mem_write (esil, addr++, &r0, 1);
r_anal_esil_mem_write (esil, addr++, &r1, 1);
return true;
}
| 9,783 |
179,787 | 1 | vhost_scsi_make_tpg(struct se_wwn *wwn,
struct config_group *group,
const char *name)
{
struct vhost_scsi_tport *tport = container_of(wwn,
struct vhost_scsi_tport, tport_wwn);
struct vhost_scsi_tpg *tpg;
unsigned long tpgt;
int ret;
if (strstr(name, "tpgt_") != name)
return ERR_PTR(-EINVAL);
if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
return ERR_PTR(-EINVAL);
tpg = kzalloc(sizeof(struct vhost_scsi_tpg), GFP_KERNEL);
if (!tpg) {
pr_err("Unable to allocate struct vhost_scsi_tpg");
return ERR_PTR(-ENOMEM);
}
mutex_init(&tpg->tv_tpg_mutex);
INIT_LIST_HEAD(&tpg->tv_tpg_list);
tpg->tport = tport;
tpg->tport_tpgt = tpgt;
ret = core_tpg_register(&vhost_scsi_fabric_configfs->tf_ops, wwn,
&tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL);
if (ret < 0) {
kfree(tpg);
return NULL;
}
mutex_lock(&vhost_scsi_mutex);
list_add_tail(&tpg->tv_tpg_list, &vhost_scsi_list);
mutex_unlock(&vhost_scsi_mutex);
return &tpg->se_tpg;
}
| 9,784 |
175,378 | 0 | void SimpleSoftOMXComponent::checkTransitions() {
if (mState != mTargetState) {
bool transitionComplete = true;
if (mState == OMX_StateLoaded) {
CHECK_EQ((int)mTargetState, (int)OMX_StateIdle);
for (size_t i = 0; i < mPorts.size(); ++i) {
const PortInfo &port = mPorts.itemAt(i);
if (port.mDef.bEnabled == OMX_FALSE) {
continue;
}
if (port.mDef.bPopulated == OMX_FALSE) {
transitionComplete = false;
break;
}
}
} else if (mTargetState == OMX_StateLoaded) {
CHECK_EQ((int)mState, (int)OMX_StateIdle);
for (size_t i = 0; i < mPorts.size(); ++i) {
const PortInfo &port = mPorts.itemAt(i);
if (port.mDef.bEnabled == OMX_FALSE) {
continue;
}
size_t n = port.mBuffers.size();
if (n > 0) {
CHECK_LE(n, port.mDef.nBufferCountActual);
if (n == port.mDef.nBufferCountActual) {
CHECK_EQ((int)port.mDef.bPopulated, (int)OMX_TRUE);
} else {
CHECK_EQ((int)port.mDef.bPopulated, (int)OMX_FALSE);
}
transitionComplete = false;
break;
}
}
}
if (transitionComplete) {
ALOGV("state transition from %d to %d complete", mState, mTargetState);
mState = mTargetState;
if (mState == OMX_StateLoaded) {
onReset();
}
notify(OMX_EventCmdComplete, OMX_CommandStateSet, mState, NULL);
} else {
ALOGV("state transition from %d to %d not yet complete", mState, mTargetState);
}
}
for (size_t i = 0; i < mPorts.size(); ++i) {
PortInfo *port = &mPorts.editItemAt(i);
if (port->mTransition == PortInfo::DISABLING) {
if (port->mBuffers.empty()) {
ALOGV("Port %zu now disabled.", i);
port->mTransition = PortInfo::NONE;
notify(OMX_EventCmdComplete, OMX_CommandPortDisable, i, NULL);
onPortEnableCompleted(i, false /* enabled */);
}
} else if (port->mTransition == PortInfo::ENABLING) {
if (port->mDef.bPopulated == OMX_TRUE) {
ALOGV("Port %zu now enabled.", i);
port->mTransition = PortInfo::NONE;
port->mDef.bEnabled = OMX_TRUE;
notify(OMX_EventCmdComplete, OMX_CommandPortEnable, i, NULL);
onPortEnableCompleted(i, true /* enabled */);
}
}
}
}
| 9,785 |
167,800 | 0 | void WebRuntimeFeatures::EnableXSLT(bool enable) {
RuntimeEnabledFeatures::SetXSLTEnabled(enable);
}
| 9,786 |
147,074 | 0 | void WebLocalFrameImpl::SetCommittedFirstRealLoad() {
DCHECK(GetFrame());
EnsureFrameLoaderHasCommitted(GetFrame()->Loader());
}
| 9,787 |
146,078 | 0 | WebGLSampler* WebGL2RenderingContextBase::createSampler() {
if (isContextLost())
return nullptr;
return WebGLSampler::Create(this);
}
| 9,788 |
79,493 | 0 | int nntp_active_fetch(struct NntpServer *nserv, bool new)
{
struct NntpData nntp_data;
char msg[STRING];
char buf[LONG_STRING];
unsigned int i;
int rc;
snprintf(msg, sizeof(msg), _("Loading list of groups from server %s..."),
nserv->conn->account.host);
mutt_message(msg);
if (nntp_date(nserv, &nserv->newgroups_time) < 0)
return -1;
nntp_data.nserv = nserv;
nntp_data.group = NULL;
i = nserv->groups_num;
mutt_str_strfcpy(buf, "LIST\r\n", sizeof(buf));
rc = nntp_fetch_lines(&nntp_data, buf, sizeof(buf), msg, nntp_add_group, nserv);
if (rc)
{
if (rc > 0)
{
mutt_error("LIST: %s", buf);
}
return -1;
}
if (new)
{
for (; i < nserv->groups_num; i++)
{
struct NntpData *data = nserv->groups_list[i];
data->new = true;
}
}
for (i = 0; i < nserv->groups_num; i++)
{
struct NntpData *data = nserv->groups_list[i];
if (data && data->deleted && !data->newsrc_ent)
{
nntp_delete_group_cache(data);
mutt_hash_delete(nserv->groups_hash, data->group, NULL);
nserv->groups_list[i] = NULL;
}
}
if (NntpLoadDescription)
rc = get_description(&nntp_data, "*", _("Loading descriptions..."));
nntp_active_save_cache(nserv);
if (rc < 0)
return -1;
mutt_clear_error();
return 0;
}
| 9,789 |
176,809 | 0 | status_t Parcel::writeUtf8VectorAsUtf16Vector(const std::vector<std::string>& val) {
return writeTypedVector(val, &Parcel::writeUtf8AsUtf16);
}
| 9,790 |
66,686 | 0 | static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
{
dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__,
adap->id);
return usb_urb_exitv2(&adap->stream);
}
| 9,791 |
212 | 0 | freefileinfo (struct fileinfo *f)
{
while (f)
{
struct fileinfo *next = f->next;
xfree (f->name);
if (f->linkto)
xfree (f->linkto);
xfree (f);
f = next;
}
}
| 9,792 |
72,914 | 0 | static int jpc_calcssexp(jpc_fix_t stepsize)
{
return jpc_firstone(stepsize) - JPC_FIX_FRACBITS;
}
| 9,793 |
28,776 | 0 | int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu)
{
int highest_irr;
/* This may race with setting of irr in __apic_accept_irq() and
* value returned may be wrong, but kvm_vcpu_kick() in __apic_accept_irq
* will cause vmexit immediately and the value will be recalculated
* on the next vmentry.
*/
if (!kvm_vcpu_has_lapic(vcpu))
return 0;
highest_irr = apic_find_highest_irr(vcpu->arch.apic);
return highest_irr;
}
| 9,794 |
91,426 | 0 | static void clean_func_state(struct bpf_verifier_env *env,
struct bpf_func_state *st)
{
enum bpf_reg_liveness live;
int i, j;
for (i = 0; i < BPF_REG_FP; i++) {
live = st->regs[i].live;
/* liveness must not touch this register anymore */
st->regs[i].live |= REG_LIVE_DONE;
if (!(live & REG_LIVE_READ))
/* since the register is unused, clear its state
* to make further comparison simpler
*/
__mark_reg_not_init(&st->regs[i]);
}
for (i = 0; i < st->allocated_stack / BPF_REG_SIZE; i++) {
live = st->stack[i].spilled_ptr.live;
/* liveness must not touch this stack slot anymore */
st->stack[i].spilled_ptr.live |= REG_LIVE_DONE;
if (!(live & REG_LIVE_READ)) {
__mark_reg_not_init(&st->stack[i].spilled_ptr);
for (j = 0; j < BPF_REG_SIZE; j++)
st->stack[i].slot_type[j] = STACK_INVALID;
}
}
}
| 9,795 |
170,048 | 0 | xsltXPathVariableLookup(void *ctxt, const xmlChar *name,
const xmlChar *ns_uri) {
xsltTransformContextPtr tctxt;
xmlXPathObjectPtr valueObj = NULL;
if ((ctxt == NULL) || (name == NULL))
return(NULL);
#ifdef WITH_XSLT_DEBUG_VARIABLE
XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
"Lookup variable '%s'\n", name));
#endif
tctxt = (xsltTransformContextPtr) ctxt;
/*
* Local variables/params ---------------------------------------------
*
* Do the lookup from the top of the stack, but
* don't use params being computed in a call-param
* First lookup expects the variable name and URI to
* come from the disctionnary and hence pointer comparison.
*/
if (tctxt->varsNr != 0) {
int i;
xsltStackElemPtr variable = NULL, cur;
for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
cur = tctxt->varsTab[i-1];
if ((cur->name == name) && (cur->nameURI == ns_uri)) {
#if 0
stack_addr++;
#endif
variable = cur;
goto local_variable_found;
}
cur = cur->next;
}
/*
* Redo the lookup with interned strings to avoid string comparison.
*
* OPTIMIZE TODO: The problem here is, that if we request a
* global variable, then this will be also executed.
*/
{
const xmlChar *tmpName = name, *tmpNsName = ns_uri;
name = xmlDictLookup(tctxt->dict, name, -1);
if (ns_uri)
ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1);
if ((tmpName != name) || (tmpNsName != ns_uri)) {
for (i = tctxt->varsNr; i > tctxt->varsBase; i--) {
cur = tctxt->varsTab[i-1];
if ((cur->name == name) && (cur->nameURI == ns_uri)) {
#if 0
stack_cmp++;
#endif
variable = cur;
goto local_variable_found;
}
}
}
}
local_variable_found:
if (variable) {
if (variable->computed == 0) {
#ifdef WITH_XSLT_DEBUG_VARIABLE
XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
"uncomputed variable '%s'\n", name));
#endif
variable->value = xsltEvalVariable(tctxt, variable, NULL);
variable->computed = 1;
}
if (variable->value != NULL) {
valueObj = xmlXPathObjectCopy(variable->value);
}
return(valueObj);
}
}
/*
* Global variables/params --------------------------------------------
*/
if (tctxt->globalVars) {
valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri);
}
if (valueObj == NULL) {
#ifdef WITH_XSLT_DEBUG_VARIABLE
XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
"variable not found '%s'\n", name));
#endif
if (ns_uri) {
xsltTransformError(tctxt, NULL, tctxt->inst,
"Variable '{%s}%s' has not been declared.\n", ns_uri, name);
} else {
xsltTransformError(tctxt, NULL, tctxt->inst,
"Variable '%s' has not been declared.\n", name);
}
} else {
#ifdef WITH_XSLT_DEBUG_VARIABLE
XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
"found variable '%s'\n", name));
#endif
}
return(valueObj);
}
| 9,796 |
4,562 | 0 | static int php_openssl_is_private_key(EVP_PKEY* pkey)
{
assert(pkey != NULL);
switch (EVP_PKEY_id(pkey)) {
#ifndef NO_RSA
case EVP_PKEY_RSA:
case EVP_PKEY_RSA2:
{
RSA *rsa = EVP_PKEY_get0_RSA(pkey);
if (rsa != NULL) {
const BIGNUM *p, *q;
RSA_get0_factors(rsa, &p, &q);
if (p == NULL || q == NULL) {
return 0;
}
}
}
break;
#endif
#ifndef NO_DSA
case EVP_PKEY_DSA:
case EVP_PKEY_DSA1:
case EVP_PKEY_DSA2:
case EVP_PKEY_DSA3:
case EVP_PKEY_DSA4:
{
DSA *dsa = EVP_PKEY_get0_DSA(pkey);
if (dsa != NULL) {
const BIGNUM *p, *q, *g, *pub_key, *priv_key;
DSA_get0_pqg(dsa, &p, &q, &g);
if (p == NULL || q == NULL) {
return 0;
}
DSA_get0_key(dsa, &pub_key, &priv_key);
if (priv_key == NULL) {
return 0;
}
}
}
break;
#endif
#ifndef NO_DH
case EVP_PKEY_DH:
{
DH *dh = EVP_PKEY_get0_DH(pkey);
if (dh != NULL) {
const BIGNUM *p, *q, *g, *pub_key, *priv_key;
DH_get0_pqg(dh, &p, &q, &g);
if (p == NULL) {
return 0;
}
DH_get0_key(dh, &pub_key, &priv_key);
if (priv_key == NULL) {
return 0;
}
}
}
break;
#endif
#ifdef HAVE_EVP_PKEY_EC
case EVP_PKEY_EC:
{
EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey);
if (ec != NULL && NULL == EC_KEY_get0_private_key(ec)) {
return 0;
}
}
break;
#endif
default:
php_error_docref(NULL, E_WARNING, "key type not supported in this PHP build!");
break;
}
return 1;
}
| 9,797 |
51,848 | 0 | dissect_common_ul_node_synchronisation(packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb, int offset)
{
guint32 t1, t2, t3;
/* T1 (3 bytes) */
t1 = tvb_get_ntoh24(tvb, offset);
proto_tree_add_item(tree, hf_fp_t1, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
/* T2 (3 bytes) */
t2 = tvb_get_ntoh24(tvb, offset);
proto_tree_add_item(tree, hf_fp_t2, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
/* T3 (3 bytes) */
t3 = tvb_get_ntoh24(tvb, offset);
proto_tree_add_item(tree, hf_fp_t3, tvb, offset, 3, ENC_BIG_ENDIAN);
offset += 3;
col_append_fstr(pinfo->cinfo, COL_INFO, " T1=%u T2=%u, T3=%u",
t1, t2, t3);
return offset;
}
| 9,798 |
19,454 | 0 | efx_ethtool_get_rxnfc(struct net_device *net_dev,
struct ethtool_rxnfc *info, u32 *rules __always_unused)
{
struct efx_nic *efx = netdev_priv(net_dev);
switch (info->cmd) {
case ETHTOOL_GRXRINGS:
info->data = efx->n_rx_channels;
return 0;
case ETHTOOL_GRXFH: {
unsigned min_revision = 0;
info->data = 0;
switch (info->flow_type) {
case TCP_V4_FLOW:
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/* fall through */
case UDP_V4_FLOW:
case SCTP_V4_FLOW:
case AH_ESP_V4_FLOW:
case IPV4_FLOW:
info->data |= RXH_IP_SRC | RXH_IP_DST;
min_revision = EFX_REV_FALCON_B0;
break;
case TCP_V6_FLOW:
info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/* fall through */
case UDP_V6_FLOW:
case SCTP_V6_FLOW:
case AH_ESP_V6_FLOW:
case IPV6_FLOW:
info->data |= RXH_IP_SRC | RXH_IP_DST;
min_revision = EFX_REV_SIENA_A0;
break;
default:
break;
}
if (efx_nic_rev(efx) < min_revision)
info->data = 0;
return 0;
}
default:
return -EOPNOTSUPP;
}
}
| 9,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.