unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
143,206 | 0 | Node* Document::importNode(Node* importedNode, bool deep, ExceptionState& exceptionState)
{
switch (importedNode->getNodeType()) {
case TEXT_NODE:
return createTextNode(importedNode->nodeValue());
case CDATA_SECTION_NODE:
return CDATASection::create(*this, importedNode->nodeValue());
case PROCESSING_INSTRUCTION_NODE:
return createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue(), exceptionState);
case COMMENT_NODE:
return createComment(importedNode->nodeValue());
case DOCUMENT_TYPE_NODE: {
DocumentType* doctype = toDocumentType(importedNode);
return DocumentType::create(this, doctype->name(), doctype->publicId(), doctype->systemId());
}
case ELEMENT_NODE: {
Element* oldElement = toElement(importedNode);
if (!hasValidNamespaceForElements(oldElement->tagQName())) {
exceptionState.throwDOMException(NamespaceError, "The imported node has an invalid namespace.");
return nullptr;
}
Element* newElement = createElement(oldElement->tagQName(), CreatedByImportNode);
newElement->cloneDataFromElement(*oldElement);
if (deep) {
if (!importContainerNodeChildren(oldElement, newElement, exceptionState))
return nullptr;
if (isHTMLTemplateElement(*oldElement)
&& !ensureTemplateDocument().importContainerNodeChildren(
toHTMLTemplateElement(oldElement)->content(),
toHTMLTemplateElement(newElement)->content(), exceptionState))
return nullptr;
}
return newElement;
}
case ATTRIBUTE_NODE:
return Attr::create(*this, QualifiedName(nullAtom, AtomicString(toAttr(importedNode)->name()), nullAtom), toAttr(importedNode)->value());
case DOCUMENT_FRAGMENT_NODE: {
if (importedNode->isShadowRoot()) {
exceptionState.throwDOMException(NotSupportedError, "The node provided is a shadow root, which may not be imported.");
return nullptr;
}
DocumentFragment* oldFragment = toDocumentFragment(importedNode);
DocumentFragment* newFragment = createDocumentFragment();
if (deep && !importContainerNodeChildren(oldFragment, newFragment, exceptionState))
return nullptr;
return newFragment;
}
case DOCUMENT_NODE:
exceptionState.throwDOMException(NotSupportedError, "The node provided is a document, which may not be imported.");
return nullptr;
}
ASSERT_NOT_REACHED();
return nullptr;
}
| 9,600 |
156,213 | 0 | RendererSchedulerImpl::InputTaskRunner() {
helper_.CheckOnValidThread();
return input_task_queue_;
}
| 9,601 |
28,733 | 0 | static int apic_set_eoi(struct kvm_lapic *apic)
{
int vector = apic_find_highest_isr(apic);
trace_kvm_eoi(apic, vector);
/*
* Not every write EOI will has corresponding ISR,
* one example is when Kernel check timer on setup_IO_APIC
*/
if (vector == -1)
return vector;
apic_clear_isr(vector, apic);
apic_update_ppr(apic);
kvm_ioapic_send_eoi(apic, vector);
kvm_make_request(KVM_REQ_EVENT, apic->vcpu);
return vector;
}
| 9,602 |
177,971 | 1 | e1000e_ring_empty(E1000ECore *core, const E1000E_RingInfo *r)
{
return core->mac[r->dh] == core->mac[r->dt];
}
| 9,603 |
85,319 | 0 | check_quotas(cupsd_client_t *con, /* I - Client connection */
cupsd_printer_t *p) /* I - Printer or class */
{
char username[33], /* Username */
*name; /* Current user name */
cupsd_quota_t *q; /* Quota data */
#ifdef HAVE_MBR_UID_TO_UUID
/*
* Use Apple membership APIs which require that all names represent
* valid user account or group records accessible by the server.
*/
uuid_t usr_uuid; /* UUID for job requesting user */
uuid_t usr2_uuid; /* UUID for ACL user name entry */
uuid_t grp_uuid; /* UUID for ACL group name entry */
int mbr_err; /* Error from membership function */
int is_member; /* Is this user a member? */
#else
/*
* Use standard POSIX APIs for checking users and groups...
*/
struct passwd *pw; /* User password data */
#endif /* HAVE_MBR_UID_TO_UUID */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "check_quotas(%p[%d], %p[%s])",
con, con->number, p, p->name);
/*
* Figure out who is printing...
*/
strlcpy(username, get_username(con), sizeof(username));
if ((name = strchr(username, '@')) != NULL)
*name = '\0'; /* Strip @REALM */
/*
* Check global active job limits for printers and users...
*/
if (MaxJobsPerPrinter)
{
/*
* Check if there are too many pending jobs on this printer...
*/
if (cupsdGetPrinterJobCount(p->name) >= MaxJobsPerPrinter)
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for printer \"%s\"...",
p->name);
return (-1);
}
}
if (MaxJobsPerUser)
{
/*
* Check if there are too many pending jobs for this user...
*/
if (cupsdGetUserJobCount(username) >= MaxJobsPerUser)
{
cupsdLogMessage(CUPSD_LOG_INFO, "Too many jobs for user \"%s\"...",
username);
return (-1);
}
}
/*
* Check against users...
*/
if (cupsArrayCount(p->users) == 0 && p->k_limit == 0 && p->page_limit == 0)
return (1);
if (cupsArrayCount(p->users))
{
#ifdef HAVE_MBR_UID_TO_UUID
/*
* Get UUID for job requesting user...
*/
if (mbr_user_name_to_uuid((char *)username, usr_uuid))
{
/*
* Unknown user...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG,
"check_quotas: UUID lookup failed for user \"%s\"",
username);
cupsdLogMessage(CUPSD_LOG_INFO,
"Denying user \"%s\" access to printer \"%s\" "
"(unknown user)...",
username, p->name);
return (0);
}
#else
/*
* Get UID and GID of requesting user...
*/
pw = getpwnam(username);
endpwent();
#endif /* HAVE_MBR_UID_TO_UUID */
for (name = (char *)cupsArrayFirst(p->users);
name;
name = (char *)cupsArrayNext(p->users))
if (name[0] == '@')
{
/*
* Check group membership...
*/
#ifdef HAVE_MBR_UID_TO_UUID
if (name[1] == '#')
{
if (uuid_parse(name + 2, grp_uuid))
uuid_clear(grp_uuid);
}
else if ((mbr_err = mbr_group_name_to_uuid(name + 1, grp_uuid)) != 0)
{
/*
* Invalid ACL entries are ignored for matching; just record a
* warning in the log...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG,
"check_quotas: UUID lookup failed for ACL entry "
"\"%s\" (err=%d)", name, mbr_err);
cupsdLogMessage(CUPSD_LOG_WARN,
"Access control entry \"%s\" not a valid group name; "
"entry ignored", name);
}
if ((mbr_err = mbr_check_membership(usr_uuid, grp_uuid,
&is_member)) != 0)
{
/*
* At this point, there should be no errors, but check anyways...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG,
"check_quotas: group \"%s\" membership check "
"failed (err=%d)", name + 1, mbr_err);
is_member = 0;
}
/*
* Stop if we found a match...
*/
if (is_member)
break;
#else
if (cupsdCheckGroup(username, pw, name + 1))
break;
#endif /* HAVE_MBR_UID_TO_UUID */
}
#ifdef HAVE_MBR_UID_TO_UUID
else
{
if (name[0] == '#')
{
if (uuid_parse(name + 1, usr2_uuid))
uuid_clear(usr2_uuid);
}
else if ((mbr_err = mbr_user_name_to_uuid(name, usr2_uuid)) != 0)
{
/*
* Invalid ACL entries are ignored for matching; just record a
* warning in the log...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG,
"check_quotas: UUID lookup failed for ACL entry "
"\"%s\" (err=%d)", name, mbr_err);
cupsdLogMessage(CUPSD_LOG_WARN,
"Access control entry \"%s\" not a valid user name; "
"entry ignored", name);
}
if (!uuid_compare(usr_uuid, usr2_uuid))
break;
}
#else
else if (!_cups_strcasecmp(username, name))
break;
#endif /* HAVE_MBR_UID_TO_UUID */
if ((name != NULL) == p->deny_users)
{
cupsdLogMessage(CUPSD_LOG_INFO,
"Denying user \"%s\" access to printer \"%s\"...",
username, p->name);
return (0);
}
}
/*
* Check quotas...
*/
if (p->k_limit || p->page_limit)
{
if ((q = cupsdUpdateQuota(p, username, 0, 0)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unable to allocate quota data for user \"%s\"",
username);
return (-1);
}
if ((q->k_count >= p->k_limit && p->k_limit) ||
(q->page_count >= p->page_limit && p->page_limit))
{
cupsdLogMessage(CUPSD_LOG_INFO, "User \"%s\" is over the quota limit...",
username);
return (-1);
}
}
/*
* If we have gotten this far, we're done!
*/
return (1);
}
| 9,604 |
168,864 | 0 | bool PermissionsData::IsRuntimeBlockedHostUnsafe(const GURL& url) const {
runtime_lock_.AssertAcquired();
return PolicyBlockedHostsUnsafe().MatchesURL(url) &&
!PolicyAllowedHostsUnsafe().MatchesURL(url);
}
| 9,605 |
142,488 | 0 | void ShelfLayoutManager::StopAutoHideTimer() {
auto_hide_timer_.Stop();
mouse_over_shelf_when_auto_hide_timer_started_ = false;
}
| 9,606 |
235 | 0 | bgp_attr_aggregate_intern (struct bgp *bgp, u_char origin,
struct aspath *aspath,
struct community *community, int as_set)
{
struct attr attr;
struct attr *new;
struct attr_extra *attre;
memset (&attr, 0, sizeof (struct attr));
attre = bgp_attr_extra_get (&attr);
/* Origin attribute. */
attr.origin = origin;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ORIGIN);
/* AS path attribute. */
if (aspath)
attr.aspath = aspath_intern (aspath);
else
attr.aspath = aspath_empty ();
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AS_PATH);
/* Next hop attribute. */
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_NEXT_HOP);
if (community)
{
attr.community = community;
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES);
}
attre->weight = BGP_ATTR_DEFAULT_WEIGHT;
#ifdef HAVE_IPV6
attre->mp_nexthop_len = IPV6_MAX_BYTELEN;
#endif
if (! as_set)
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_ATOMIC_AGGREGATE);
attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_AGGREGATOR);
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
attre->aggregator_as = bgp->confed_id;
else
attre->aggregator_as = bgp->as;
attre->aggregator_addr = bgp->router_id;
new = bgp_attr_intern (&attr);
bgp_attr_extra_free (&attr);
aspath_unintern (&new->aspath);
return new;
}
| 9,607 |
102,232 | 0 | void ExtensionPrefs::ClearPageOrdinal(const std::string& extension_id) {
UpdatePageOrdinalMap(GetPageOrdinal(extension_id), StringOrdinal());
UpdateExtensionPref(extension_id, kPrefPageOrdinal, NULL);
}
| 9,608 |
22,674 | 0 | static int collect_events(struct perf_event *group, int max_count,
struct perf_event *ctrs[], u64 *events,
unsigned int *flags)
{
int n = 0;
struct perf_event *event;
if (!is_software_event(group)) {
if (n >= max_count)
return -1;
ctrs[n] = group;
flags[n] = group->hw.event_base;
events[n++] = group->hw.config;
}
list_for_each_entry(event, &group->sibling_list, group_entry) {
if (!is_software_event(event) &&
event->state != PERF_EVENT_STATE_OFF) {
if (n >= max_count)
return -1;
ctrs[n] = event;
flags[n] = event->hw.event_base;
events[n++] = event->hw.config;
}
}
return n;
}
| 9,609 |
148,488 | 0 | bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host,
const IPC::Message& message) {
RenderFrameHost* main_frame = render_view_host->GetMainFrame();
if (main_frame) {
WebUIImpl* web_ui = static_cast<RenderFrameHostImpl*>(main_frame)->web_ui();
if (web_ui && web_ui->OnMessageReceived(message))
return true;
}
for (auto& observer : observers_) {
if (observer.OnMessageReceived(message))
return true;
}
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message, render_view_host)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstVisuallyNonEmptyPaint,
OnFirstVisuallyNonEmptyPaint)
IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits)
IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged,
OnPageScaleFactorChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory)
IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
#if BUILDFLAG(ENABLE_PLUGINS)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
OnRequestPpapiBrokerPermission)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
OnShowValidationMessage)
IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage,
OnHideValidationMessage)
IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage,
OnMoveValidationMessage)
#if defined(OS_ANDROID)
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, OnOpenDateTimeDialog)
#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
| 9,610 |
25,172 | 0 | static inline void rt_free(struct rtable *rt)
{
call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free);
}
| 9,611 |
23,563 | 0 | static int linear_map(struct dm_target *ti, struct bio *bio,
union map_info *map_context)
{
linear_map_bio(ti, bio);
return DM_MAPIO_REMAPPED;
}
| 9,612 |
143,068 | 0 | uint32_t DefaultAudioDestinationHandler::MaxChannelCount() const {
return AudioDestination::MaxChannelCount();
}
| 9,613 |
26,283 | 0 | static void free_rootdomain(struct rcu_head *rcu)
{
struct root_domain *rd = container_of(rcu, struct root_domain, rcu);
cpupri_cleanup(&rd->cpupri);
free_cpumask_var(rd->rto_mask);
free_cpumask_var(rd->online);
free_cpumask_var(rd->span);
kfree(rd);
}
| 9,614 |
73,110 | 0 | MagickExport Image *ColorMatrixImage(const Image *image,
const KernelInfo *color_matrix,ExceptionInfo *exception)
{
#define ColorMatrixImageTag "ColorMatrix/Image"
CacheView
*color_view,
*image_view;
double
ColorMatrix[6][6] =
{
{ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 },
{ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 },
{ 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }
};
Image
*color_image;
MagickBooleanType
status;
MagickOffsetType
progress;
register ssize_t
i;
ssize_t
u,
v,
y;
/*
Map given color_matrix, into a 6x6 matrix RGBKA and a constant
*/
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
i=0;
for (v=0; v < (ssize_t) color_matrix->height; v++)
for (u=0; u < (ssize_t) color_matrix->width; u++)
{
if ((v < 6) && (u < 6))
ColorMatrix[v][u]=color_matrix->values[i];
i++;
}
/*
Initialize color image.
*/
color_image=CloneImage(image,0,0,MagickTrue,exception);
if (color_image == (Image *) NULL)
return((Image *) NULL);
if (SetImageStorageClass(color_image,DirectClass,exception) == MagickFalse)
{
color_image=DestroyImage(color_image);
return((Image *) NULL);
}
if (image->debug != MagickFalse)
{
char
format[MagickPathExtent],
*message;
(void) LogMagickEvent(TransformEvent,GetMagickModule(),
" ColorMatrix image with color matrix:");
message=AcquireString("");
for (v=0; v < 6; v++)
{
*message='\0';
(void) FormatLocaleString(format,MagickPathExtent,"%.20g: ",(double) v);
(void) ConcatenateString(&message,format);
for (u=0; u < 6; u++)
{
(void) FormatLocaleString(format,MagickPathExtent,"%+f ",
ColorMatrix[v][u]);
(void) ConcatenateString(&message,format);
}
(void) LogMagickEvent(TransformEvent,GetMagickModule(),"%s",message);
}
message=DestroyString(message);
}
/*
Apply the ColorMatrix to image.
*/
status=MagickTrue;
progress=0;
image_view=AcquireVirtualCacheView(image,exception);
color_view=AcquireAuthenticCacheView(color_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(progress,status) \
magick_threads(image,color_image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
PixelInfo
pixel;
register const Quantum
*magick_restrict p;
register Quantum
*magick_restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
q=GetCacheViewAuthenticPixels(color_view,0,y,color_image->columns,1,
exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
{
status=MagickFalse;
continue;
}
GetPixelInfo(image,&pixel);
for (x=0; x < (ssize_t) image->columns; x++)
{
register ssize_t
v;
size_t
height;
GetPixelInfoPixel(image,p,&pixel);
height=color_matrix->height > 6 ? 6UL : color_matrix->height;
for (v=0; v < (ssize_t) height; v++)
{
double
sum;
sum=ColorMatrix[v][0]*GetPixelRed(image,p)+ColorMatrix[v][1]*
GetPixelGreen(image,p)+ColorMatrix[v][2]*GetPixelBlue(image,p);
if (image->colorspace == CMYKColorspace)
sum+=ColorMatrix[v][3]*GetPixelBlack(image,p);
if (image->alpha_trait != UndefinedPixelTrait)
sum+=ColorMatrix[v][4]*GetPixelAlpha(image,p);
sum+=QuantumRange*ColorMatrix[v][5];
switch (v)
{
case 0: pixel.red=sum; break;
case 1: pixel.green=sum; break;
case 2: pixel.blue=sum; break;
case 3: pixel.black=sum; break;
case 4: pixel.alpha=sum; break;
default: break;
}
}
SetPixelViaPixelInfo(color_image,&pixel,q);
p+=GetPixelChannels(image);
q+=GetPixelChannels(color_image);
}
if (SyncCacheViewAuthenticPixels(color_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_ColorMatrixImage)
#endif
proceed=SetImageProgress(image,ColorMatrixImageTag,progress++,
image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
color_view=DestroyCacheView(color_view);
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
color_image=DestroyImage(color_image);
return(color_image);
}
| 9,615 |
27,013 | 0 | static bool is_valid_NPEvent_type(NPEvent *event)
{
switch (event->type) {
case GraphicsExpose:
case FocusIn:
case FocusOut:
case EnterNotify:
case LeaveNotify:
case MotionNotify:
case ButtonPress:
case ButtonRelease:
case KeyPress:
case KeyRelease:
return true;
default:
break;
}
return false;
}
| 9,616 |
62,549 | 0 | parse_field(netdissect_options *ndo, const char **pptr, int *len)
{
const char *s;
if (*len <= 0 || !pptr || !*pptr)
return NULL;
if (*pptr > (const char *) ndo->ndo_snapend)
return NULL;
s = *pptr;
while (*pptr <= (const char *) ndo->ndo_snapend && *len >= 0 && **pptr) {
(*pptr)++;
(*len)--;
}
(*pptr)++;
(*len)--;
if (*len < 0 || *pptr > (const char *) ndo->ndo_snapend)
return NULL;
return s;
}
| 9,617 |
52,271 | 0 | check_match(struct xt_entry_match *m, struct xt_mtchk_param *par)
{
const struct ipt_ip *ip = par->entryinfo;
int ret;
par->match = m->u.kernel.match;
par->matchinfo = m->data;
ret = xt_check_match(par, m->u.match_size - sizeof(*m),
ip->proto, ip->invflags & IPT_INV_PROTO);
if (ret < 0) {
duprintf("check failed for `%s'.\n", par->match->name);
return ret;
}
return 0;
}
| 9,618 |
154,963 | 0 | LRUCanvasResourceProviderCache(wtf_size_t capacity)
: resource_providers_(capacity) {}
| 9,619 |
19,002 | 0 | static void __net_exit tcp4_proc_exit_net(struct net *net)
{
tcp_proc_unregister(net, &tcp4_seq_afinfo);
}
| 9,620 |
824 | 0 | void SplashOutputDev::clip(GfxState *state) {
SplashPath *path;
path = convertPath(state, state->getPath());
splash->clipToPath(path, gFalse);
delete path;
}
| 9,621 |
132,501 | 0 | UsbListInterfacesFunction::UsbListInterfacesFunction() {
}
| 9,622 |
37,782 | 0 | static int nested_svm_exit_special(struct vcpu_svm *svm)
{
u32 exit_code = svm->vmcb->control.exit_code;
switch (exit_code) {
case SVM_EXIT_INTR:
case SVM_EXIT_NMI:
case SVM_EXIT_EXCP_BASE + MC_VECTOR:
return NESTED_EXIT_HOST;
case SVM_EXIT_NPF:
/* For now we are always handling NPFs when using them */
if (npt_enabled)
return NESTED_EXIT_HOST;
break;
case SVM_EXIT_EXCP_BASE + PF_VECTOR:
/* When we're shadowing, trap PFs, but not async PF */
if (!npt_enabled && svm->apf_reason == 0)
return NESTED_EXIT_HOST;
break;
case SVM_EXIT_EXCP_BASE + NM_VECTOR:
nm_interception(svm);
break;
default:
break;
}
return NESTED_EXIT_CONTINUE;
}
| 9,623 |
137,119 | 0 | bool InputType::SupportsRequired() const {
return SupportsValidation();
}
| 9,624 |
36,721 | 0 | make_NegHints(OM_uint32 *minor_status,
spnego_gss_cred_id_t spcred, gss_buffer_t *outbuf)
{
gss_buffer_desc hintNameBuf;
gss_name_t hintName = GSS_C_NO_NAME;
gss_name_t hintKerberosName;
gss_OID hintNameType;
OM_uint32 major_status;
OM_uint32 minor;
unsigned int tlen = 0;
unsigned int hintNameSize = 0;
unsigned char *ptr;
unsigned char *t;
*outbuf = GSS_C_NO_BUFFER;
if (spcred != NULL) {
major_status = gss_inquire_cred(minor_status,
spcred->mcred,
&hintName,
NULL,
NULL,
NULL);
if (major_status != GSS_S_COMPLETE)
return (major_status);
}
if (hintName == GSS_C_NO_NAME) {
krb5_error_code code;
krb5int_access kaccess;
char hostname[HOST_PREFIX_LEN + MAXHOSTNAMELEN + 1] = HOST_PREFIX;
code = krb5int_accessor(&kaccess, KRB5INT_ACCESS_VERSION);
if (code != 0) {
*minor_status = code;
return (GSS_S_FAILURE);
}
/* this breaks mutual authentication but Samba relies on it */
code = (*kaccess.clean_hostname)(NULL, NULL,
&hostname[HOST_PREFIX_LEN],
MAXHOSTNAMELEN);
if (code != 0) {
*minor_status = code;
return (GSS_S_FAILURE);
}
hintNameBuf.value = hostname;
hintNameBuf.length = strlen(hostname);
major_status = gss_import_name(minor_status,
&hintNameBuf,
GSS_C_NT_HOSTBASED_SERVICE,
&hintName);
if (major_status != GSS_S_COMPLETE) {
return (major_status);
}
}
hintNameBuf.value = NULL;
hintNameBuf.length = 0;
major_status = gss_canonicalize_name(minor_status,
hintName,
(gss_OID)&gss_mech_krb5_oid,
&hintKerberosName);
if (major_status != GSS_S_COMPLETE) {
gss_release_name(&minor, &hintName);
return (major_status);
}
gss_release_name(&minor, &hintName);
major_status = gss_display_name(minor_status,
hintKerberosName,
&hintNameBuf,
&hintNameType);
if (major_status != GSS_S_COMPLETE) {
gss_release_name(&minor, &hintName);
return (major_status);
}
gss_release_name(&minor, &hintKerberosName);
/*
* Now encode the name hint into a NegHints ASN.1 type
*/
major_status = GSS_S_FAILURE;
/* Length of DER encoded GeneralString */
tlen = 1 + gssint_der_length_size(hintNameBuf.length) +
hintNameBuf.length;
hintNameSize = tlen;
/* Length of DER encoded hintName */
tlen += 1 + gssint_der_length_size(hintNameSize);
t = gssalloc_malloc(tlen);
if (t == NULL) {
*minor_status = ENOMEM;
goto errout;
}
ptr = t;
*ptr++ = CONTEXT | 0x00; /* hintName identifier */
if (gssint_put_der_length(hintNameSize,
&ptr, tlen - (int)(ptr-t)))
goto errout;
*ptr++ = GENERAL_STRING;
if (gssint_put_der_length(hintNameBuf.length,
&ptr, tlen - (int)(ptr-t)))
goto errout;
memcpy(ptr, hintNameBuf.value, hintNameBuf.length);
ptr += hintNameBuf.length;
*outbuf = (gss_buffer_t)malloc(sizeof(gss_buffer_desc));
if (*outbuf == NULL) {
*minor_status = ENOMEM;
goto errout;
}
(*outbuf)->value = (void *)t;
(*outbuf)->length = ptr - t;
t = NULL; /* don't free */
*minor_status = 0;
major_status = GSS_S_COMPLETE;
errout:
if (t != NULL) {
free(t);
}
gss_release_buffer(&minor, &hintNameBuf);
return (major_status);
}
| 9,625 |
14,233 | 0 | int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stream TSRMLS_DC) /* {{{ */
{
zval **val = NULL;
char *cnmatch = NULL;
X509_NAME *name;
char buf[1024];
int err;
/* verification is turned off */
if (!(GET_VER_OPT("verify_peer") && zval_is_true(*val))) {
return SUCCESS;
}
if (peer == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not get peer certificate");
return FAILURE;
}
err = SSL_get_verify_result(ssl);
switch (err) {
case X509_V_OK:
/* fine */
break;
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
if (GET_VER_OPT("allow_self_signed") && zval_is_true(*val)) {
/* allowed */
break;
}
/* not allowed, so fall through */
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not verify peer: code:%d %s", err, X509_verify_cert_error_string(err));
return FAILURE;
}
/* if the cert passed the usual checks, apply our own local policies now */
name = X509_get_subject_name(peer);
/* Does the common name match ? (used primarily for https://) */
GET_VER_OPT_STRING("CN_match", cnmatch);
if (cnmatch) {
int match = 0;
int name_len = X509_NAME_get_text_by_NID(name, NID_commonName, buf, sizeof(buf));
if (name_len == -1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to locate peer certificate CN");
return FAILURE;
} else if (name_len != strlen(buf)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' is malformed", name_len, buf);
return FAILURE;
}
match = strcasecmp(cnmatch, buf) == 0;
if (!match && strlen(buf) > 3 && buf[0] == '*' && buf[1] == '.') {
/* Try wildcard */
if (strchr(buf+2, '.')) {
char *tmp = strstr(cnmatch, buf+1);
match = tmp && strcasecmp(tmp, buf+2) && tmp == strchr(cnmatch, '.');
}
}
if (!match) {
/* didn't match */
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' did not match expected CN=`%s'", name_len, buf, cnmatch);
return FAILURE;
}
}
return SUCCESS;
}
/* }}} */
| 9,626 |
35,959 | 0 | xfs_da_map_covers_blocks(
int nmap,
xfs_bmbt_irec_t *mapp,
xfs_dablk_t bno,
int count)
{
int i;
xfs_fileoff_t off;
for (i = 0, off = bno; i < nmap; i++) {
if (mapp[i].br_startblock == HOLESTARTBLOCK ||
mapp[i].br_startblock == DELAYSTARTBLOCK) {
return 0;
}
if (off != mapp[i].br_startoff) {
return 0;
}
off += mapp[i].br_blockcount;
}
return off == bno + count;
}
| 9,627 |
127,252 | 0 | WtsConsoleSessionProcessDriver::WtsConsoleSessionProcessDriver(
const base::Closure& stopped_callback,
WtsConsoleMonitor* monitor,
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
: Stoppable(caller_task_runner, stopped_callback),
caller_task_runner_(caller_task_runner),
io_task_runner_(io_task_runner),
monitor_(monitor) {
monitor_->AddWtsConsoleObserver(this);
}
| 9,628 |
104,775 | 0 | virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
if (type == NotificationType::NAV_LIST_PRUNED) {
notification_count_++;
details_ = *(Details<NavigationController::PrunedDetails>(details).ptr());
}
}
| 9,629 |
121,066 | 0 | void PixelBufferRasterWorkerPool::CheckForCompletedUploads() {
RasterTaskDeque tasks_with_completed_uploads;
while (!tasks_with_pending_upload_.empty()) {
internal::RasterWorkerPoolTask* task =
tasks_with_pending_upload_.front().get();
if (!resource_provider()->DidSetPixelsComplete(task->resource()->id()))
break;
tasks_with_completed_uploads.push_back(task);
tasks_with_pending_upload_.pop_front();
}
DCHECK(client());
bool should_force_some_uploads_to_complete =
shutdown_ || client()->ShouldForceTasksRequiredForActivationToComplete();
if (should_force_some_uploads_to_complete) {
RasterTaskDeque tasks_with_uploads_to_force;
RasterTaskDeque::iterator it = tasks_with_pending_upload_.begin();
while (it != tasks_with_pending_upload_.end()) {
internal::RasterWorkerPoolTask* task = it->get();
DCHECK(pixel_buffer_tasks_.find(task) != pixel_buffer_tasks_.end());
if (shutdown_ || IsRasterTaskRequiredForActivation(task)) {
tasks_with_uploads_to_force.push_back(task);
tasks_with_completed_uploads.push_back(task);
it = tasks_with_pending_upload_.erase(it);
continue;
}
++it;
}
for (RasterTaskDeque::reverse_iterator it =
tasks_with_uploads_to_force.rbegin();
it != tasks_with_uploads_to_force.rend(); ++it) {
resource_provider()->ForceSetPixelsToComplete((*it)->resource()->id());
has_performed_uploads_since_last_flush_ = true;
}
}
while (!tasks_with_completed_uploads.empty()) {
internal::RasterWorkerPoolTask* task =
tasks_with_completed_uploads.front().get();
resource_provider()->ReleasePixelBuffer(task->resource()->id());
bytes_pending_upload_ -= task->resource()->bytes();
task->DidRun(false);
DCHECK(std::find(completed_tasks_.begin(),
completed_tasks_.end(),
task) == completed_tasks_.end());
completed_tasks_.push_back(task);
tasks_required_for_activation_.erase(task);
tasks_with_completed_uploads.pop_front();
}
}
| 9,630 |
47,484 | 0 | static int cfg_keys(struct cryp_ctx *ctx)
{
int i;
int num_of_regs = ctx->keylen / 8;
u32 swapped_key[CRYP_MAX_KEY_SIZE / 4];
int cryp_error = 0;
dev_dbg(ctx->device->dev, "[%s]", __func__);
if (mode_is_aes(ctx->config.algomode)) {
swap_words_in_key_and_bits_in_byte((u8 *)ctx->key,
(u8 *)swapped_key,
ctx->keylen);
} else {
for (i = 0; i < ctx->keylen / 4; i++)
swapped_key[i] = uint8p_to_uint32_be(ctx->key + i*4);
}
for (i = 0; i < num_of_regs; i++) {
cryp_error = set_key(ctx->device,
*(((u32 *)swapped_key)+i*2),
*(((u32 *)swapped_key)+i*2+1),
(enum cryp_key_reg_index) i);
if (cryp_error != 0) {
dev_err(ctx->device->dev, "[%s]: set_key() failed!",
__func__);
return cryp_error;
}
}
return cryp_error;
}
| 9,631 |
95,258 | 0 | void service_abort(int error)
{
shut_down(error);
}
| 9,632 |
45,715 | 0 | static int crypto_ecb_setkey(struct crypto_tfm *parent, const u8 *key,
unsigned int keylen)
{
struct crypto_ecb_ctx *ctx = crypto_tfm_ctx(parent);
struct crypto_cipher *child = ctx->child;
int err;
crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK);
crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) &
CRYPTO_TFM_REQ_MASK);
err = crypto_cipher_setkey(child, key, keylen);
crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) &
CRYPTO_TFM_RES_MASK);
return err;
}
| 9,633 |
66,308 | 0 | static void utf8cvt_emitoctet(struct iw_utf8cvt_struct *s, unsigned char c)
{
if(s->dp > s->dstlen-2) return;
s->dst[s->dp] = (char)c;
s->dp++;
}
| 9,634 |
146,033 | 0 | bool WebGL2RenderingContextBase::ValidateGetFramebufferAttachmentParameterFunc(
const char* function_name,
GLenum target,
GLenum attachment) {
if (!ValidateFramebufferTarget(target)) {
SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid target");
return false;
}
WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target);
DCHECK(framebuffer_binding || GetDrawingBuffer());
if (!framebuffer_binding) {
switch (attachment) {
case GL_BACK:
case GL_DEPTH:
case GL_STENCIL:
break;
default:
SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid attachment");
return false;
}
} else {
switch (attachment) {
case GL_COLOR_ATTACHMENT0:
case GL_DEPTH_ATTACHMENT:
case GL_STENCIL_ATTACHMENT:
break;
case GL_DEPTH_STENCIL_ATTACHMENT:
if (framebuffer_binding->GetAttachmentObject(GL_DEPTH_ATTACHMENT) !=
framebuffer_binding->GetAttachmentObject(GL_STENCIL_ATTACHMENT)) {
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"different objects are bound to the depth and "
"stencil attachment points");
return false;
}
break;
default:
if (attachment > GL_COLOR_ATTACHMENT0 &&
attachment < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 +
MaxColorAttachments()))
break;
SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid attachment");
return false;
}
}
return true;
}
| 9,635 |
7,679 | 0 | static int handle_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
const char *name, FsCred *credp)
{
int dirfd, ret;
struct handle_data *data = (struct handle_data *)fs_ctx->private;
dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH);
if (dirfd < 0) {
return dirfd;
}
ret = mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev);
if (!ret) {
ret = handle_update_file_cred(dirfd, name, credp);
}
close(dirfd);
return ret;
}
| 9,636 |
32,994 | 0 | static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
{
/* Applicable to UDP-style socket only */
if (sctp_style(sk, TCP))
return -EOPNOTSUPP;
if (len < sizeof(int))
return -EINVAL;
len = sizeof(int);
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, &sctp_sk(sk)->autoclose, sizeof(int)))
return -EFAULT;
return 0;
}
| 9,637 |
17,819 | 0 | static void nbd_send_opt_abort(QIOChannel *ioc)
{
/* Technically, a compliant server is supposed to reply to us; but
* older servers disconnected instead. At any rate, we're allowed
* to disconnect without waiting for the server reply, so we don't
* even care if the request makes it to the server, let alone
* waiting around for whether the server replies. */
nbd_send_option_request(ioc, NBD_OPT_ABORT, 0, NULL, NULL);
}
| 9,638 |
73,616 | 0 | MagickExport PixelPacket *GetAuthenticPixelQueue(const Image *image)
{
CacheInfo
*restrict cache_info;
const int
id = GetOpenMPThreadId();
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickSignature);
if (cache_info->methods.get_authentic_pixels_from_handler !=
(GetAuthenticPixelsFromHandler) NULL)
return(cache_info->methods.get_authentic_pixels_from_handler(image));
assert(id < (int) cache_info->number_threads);
return(cache_info->nexus_info[id]->pixels);
}
| 9,639 |
152,296 | 0 | void RenderFrameImpl::DidUpdateCurrentHistoryItem() {
render_view_->StartNavStateSyncTimerIfNecessary(this);
}
| 9,640 |
137,981 | 0 | AXObject::AXRange AXLayoutObject::selection() const {
AXRange textSelection = textControlSelection();
if (textSelection.isValid())
return textSelection;
if (!getLayoutObject() || !getLayoutObject()->frame())
return AXRange();
VisibleSelection selection =
getLayoutObject()
->frame()
->selection()
.computeVisibleSelectionInDOMTreeDeprecated();
if (selection.isNone())
return AXRange();
VisiblePosition visibleStart = selection.visibleStart();
Position start = visibleStart.toParentAnchoredPosition();
TextAffinity startAffinity = visibleStart.affinity();
VisiblePosition visibleEnd = selection.visibleEnd();
Position end = visibleEnd.toParentAnchoredPosition();
TextAffinity endAffinity = visibleEnd.affinity();
Node* anchorNode = start.anchorNode();
ASSERT(anchorNode);
AXLayoutObject* anchorObject = nullptr;
while (anchorNode) {
anchorObject = getUnignoredObjectFromNode(*anchorNode);
if (anchorObject)
break;
if (anchorNode->nextSibling())
anchorNode = anchorNode->nextSibling();
else
anchorNode = anchorNode->parentNode();
}
Node* focusNode = end.anchorNode();
ASSERT(focusNode);
AXLayoutObject* focusObject = nullptr;
while (focusNode) {
focusObject = getUnignoredObjectFromNode(*focusNode);
if (focusObject)
break;
if (focusNode->previousSibling())
focusNode = focusNode->previousSibling();
else
focusNode = focusNode->parentNode();
}
if (!anchorObject || !focusObject)
return AXRange();
int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart);
ASSERT(anchorOffset >= 0);
int focusOffset = focusObject->indexForVisiblePosition(visibleEnd);
ASSERT(focusOffset >= 0);
return AXRange(anchorObject, anchorOffset, startAffinity, focusObject,
focusOffset, endAffinity);
}
| 9,641 |
98,663 | 0 | void RenderWidget::didChangeCursor(const WebCursorInfo& cursor_info) {
WebCursor cursor(cursor_info);
if (!current_cursor_.IsEqual(cursor)) {
current_cursor_ = cursor;
Send(new ViewHostMsg_SetCursor(routing_id_, cursor));
}
}
| 9,642 |
152,861 | 0 | UkmPageLoadMetricsObserver::CreateIfNeeded() {
if (!ukm::UkmRecorder::Get()) {
return nullptr;
}
return std::make_unique<UkmPageLoadMetricsObserver>(
g_browser_process->network_quality_tracker());
}
| 9,643 |
24,507 | 0 | convert_delimiter(char *path, char delim)
{
int i;
char old_delim;
if (path == NULL)
return;
if (delim == '/')
old_delim = '\\';
else
old_delim = '/';
for (i = 0; path[i] != '\0'; i++) {
if (path[i] == old_delim)
path[i] = delim;
}
}
| 9,644 |
109,547 | 0 | void PrintWebViewHelper::didStopLoading() {
PrintPages(print_web_view_->mainFrame(), WebKit::WebNode());
}
| 9,645 |
13,978 | 0 | gsicc_manager_finalize(const gs_memory_t *memory, void * vptr)
{
gsicc_manager_t *icc_man = (gsicc_manager_t *)vptr;
gsicc_manager_free_contents(icc_man, "gsicc_manager_finalize");
}
| 9,646 |
10,943 | 0 | static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value TSRMLS_DC)
{
image_info_data *info_data;
image_info_data *list;
if (value) {
list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0);
image_info->info_list[section_index].list = list;
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_STRING;
info_data->length = 1;
info_data->name = estrdup(name);
info_data->value.s = estrdup(value);
image_info->sections_found |= 1<<section_index;
image_info->info_list[section_index].count++;
}
}
| 9,647 |
11,520 | 0 | int fchmod_umask(int fd, mode_t m) {
mode_t u;
int r;
u = umask(0777);
r = fchmod(fd, m & (~u)) < 0 ? -errno : 0;
umask(u);
return r;
}
| 9,648 |
106,306 | 0 | void SyncBackendHost::Core::DoRequestConfig(
const syncable::ModelTypeBitSet& added_types,
sync_api::ConfigureReason reason) {
syncapi_->RequestConfig(added_types, reason);
}
| 9,649 |
150,188 | 0 | bool StartupBrowserCreator::ProcessLastOpenedProfiles(
const base::CommandLine& command_line,
const base::FilePath& cur_dir,
chrome::startup::IsProcessStartup is_process_startup,
chrome::startup::IsFirstRun is_first_run,
Profile* last_used_profile,
const Profiles& last_opened_profiles) {
base::CommandLine command_line_without_urls(command_line.GetProgram());
for (auto& switch_pair : command_line.GetSwitches()) {
command_line_without_urls.AppendSwitchNative(switch_pair.first,
switch_pair.second);
}
size_t DEBUG_num_profiles_on_entry = last_opened_profiles.size();
base::debug::Alias(&DEBUG_num_profiles_on_entry);
int DEBUG_loop_counter = 0;
base::debug::Alias(&DEBUG_loop_counter);
base::debug::Alias(&last_opened_profiles);
const Profile* DEBUG_profile_0 = nullptr;
const Profile* DEBUG_profile_1 = nullptr;
if (!last_opened_profiles.empty())
DEBUG_profile_0 = last_opened_profiles[0];
if (last_opened_profiles.size() > 1)
DEBUG_profile_1 = last_opened_profiles[1];
base::debug::Alias(&DEBUG_profile_0);
base::debug::Alias(&DEBUG_profile_1);
size_t DEBUG_num_profiles_at_loop_start = std::numeric_limits<size_t>::max();
base::debug::Alias(&DEBUG_num_profiles_at_loop_start);
auto DEBUG_it_begin = last_opened_profiles.begin();
base::debug::Alias(&DEBUG_it_begin);
auto DEBUG_it_end = last_opened_profiles.end();
base::debug::Alias(&DEBUG_it_end);
for (auto it = last_opened_profiles.begin(); it != last_opened_profiles.end();
++it, ++DEBUG_loop_counter) {
DEBUG_num_profiles_at_loop_start = last_opened_profiles.size();
DCHECK(!(*it)->IsGuestSession());
#if !defined(OS_CHROMEOS)
if (!CanOpenProfileOnStartup(*it))
continue;
if (last_used_profile->IsGuestSession())
last_used_profile = *it;
#endif
SessionStartupPref startup_pref = GetSessionStartupPref(command_line, *it);
if (*it != last_used_profile &&
startup_pref.type == SessionStartupPref::DEFAULT &&
!HasPendingUncleanExit(*it)) {
continue;
}
if (!LaunchBrowser((*it == last_used_profile) ? command_line
: command_line_without_urls,
*it, cur_dir, is_process_startup, is_first_run)) {
return false;
}
is_process_startup = chrome::startup::IS_NOT_PROCESS_STARTUP;
}
#if !defined(OS_CHROMEOS)
if (is_process_startup == chrome::startup::IS_PROCESS_STARTUP)
ShowUserManagerOnStartup(command_line);
else
#endif
profile_launch_observer.Get().set_profile_to_activate(last_used_profile);
return true;
}
| 9,650 |
96,582 | 0 | void mbedtls_ecp_point_free( mbedtls_ecp_point *pt )
{
if( pt == NULL )
return;
mbedtls_mpi_free( &( pt->X ) );
mbedtls_mpi_free( &( pt->Y ) );
mbedtls_mpi_free( &( pt->Z ) );
}
| 9,651 |
12,842 | 0 | int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out,
const ASN1_TEMPLATE *tt)
{
return asn1_template_ex_i2d(pval, out, tt, -1, 0);
}
| 9,652 |
24,967 | 0 | int CIFSSMBNotify(const int xid, struct cifs_tcon *tcon,
const int notify_subdirs, const __u16 netfid,
__u32 filter, struct file *pfile, int multishot,
const struct nls_table *nls_codepage)
{
int rc = 0;
struct smb_com_transaction_change_notify_req *pSMB = NULL;
struct smb_com_ntransaction_change_notify_rsp *pSMBr = NULL;
struct dir_notify_req *dnotify_req;
int bytes_returned;
cFYI(1, "In CIFSSMBNotify for file handle %d", (int)netfid);
rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
(void **) &pSMBr);
if (rc)
return rc;
pSMB->TotalParameterCount = 0 ;
pSMB->TotalDataCount = 0;
pSMB->MaxParameterCount = cpu_to_le32(2);
/* BB find exact data count max from sess structure BB */
pSMB->MaxDataCount = 0; /* same in little endian or be */
/* BB VERIFY verify which is correct for above BB */
pSMB->MaxDataCount = cpu_to_le32((tcon->ses->server->maxBuf -
MAX_CIFS_HDR_SIZE) & 0xFFFFFF00);
pSMB->MaxSetupCount = 4;
pSMB->Reserved = 0;
pSMB->ParameterOffset = 0;
pSMB->DataCount = 0;
pSMB->DataOffset = 0;
pSMB->SetupCount = 4; /* single byte does not need le conversion */
pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_NOTIFY_CHANGE);
pSMB->ParameterCount = pSMB->TotalParameterCount;
if (notify_subdirs)
pSMB->WatchTree = 1; /* one byte - no le conversion needed */
pSMB->Reserved2 = 0;
pSMB->CompletionFilter = cpu_to_le32(filter);
pSMB->Fid = netfid; /* file handle always le */
pSMB->ByteCount = 0;
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *)pSMBr, &bytes_returned,
CIFS_ASYNC_OP);
if (rc) {
cFYI(1, "Error in Notify = %d", rc);
} else {
/* Add file to outstanding requests */
/* BB change to kmem cache alloc */
dnotify_req = kmalloc(
sizeof(struct dir_notify_req),
GFP_KERNEL);
if (dnotify_req) {
dnotify_req->Pid = pSMB->hdr.Pid;
dnotify_req->PidHigh = pSMB->hdr.PidHigh;
dnotify_req->Mid = pSMB->hdr.Mid;
dnotify_req->Tid = pSMB->hdr.Tid;
dnotify_req->Uid = pSMB->hdr.Uid;
dnotify_req->netfid = netfid;
dnotify_req->pfile = pfile;
dnotify_req->filter = filter;
dnotify_req->multishot = multishot;
spin_lock(&GlobalMid_Lock);
list_add_tail(&dnotify_req->lhead,
&GlobalDnotifyReqList);
spin_unlock(&GlobalMid_Lock);
} else
rc = -ENOMEM;
}
cifs_buf_release(pSMB);
return rc;
}
| 9,653 |
162,363 | 0 | void ExpectDelegateCreation() {
delegate_ = new StrictMock<MockDelegate>();
mock_delegate_factory_.PrepareDelegateForCreation(
base::WrapUnique(delegate_));
EXPECT_TRUE(
base::CancelableSyncSocket::CreatePair(&local_, foreign_socket_.get()));
EXPECT_TRUE(mem_.CreateAnonymous(kShmemSize));
EXPECT_CALL(mock_delegate_factory_, MockCreateDelegate(NotNull()))
.WillOnce(SaveArg<0>(&delegate_event_handler_));
}
| 9,654 |
34,079 | 0 | static struct dentry *udf_fh_to_parent(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type)
{
if (fh_len != 5 || fh_type != FILEID_UDF_WITH_PARENT)
return NULL;
return udf_nfs_get_inode(sb, fid->udf.parent_block,
fid->udf.parent_partref,
fid->udf.parent_generation);
}
| 9,655 |
38,251 | 0 | static void sk_filter_release(struct sk_filter *fp)
{
if (atomic_dec_and_test(&fp->refcnt))
call_rcu(&fp->rcu, sk_filter_release_rcu);
}
| 9,656 |
126,073 | 0 | ~AutomationProviderGetPasswordsObserver() {}
| 9,657 |
176,520 | 0 | xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str)
{
const char *cur;
int ret;
cur = *str;
while (*cur == '/') {
cur++;
ret = xmlParse3986Segment(&cur, 0, 1);
if (ret != 0) return(ret);
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
if (*str != cur) {
if (uri->cleanup & 2)
uri->path = STRNDUP(*str, cur - *str);
else
uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
} else {
uri->path = NULL;
}
}
*str = cur;
return (0);
}
| 9,658 |
178,168 | 1 | void TIFF_MetaHandler::ProcessXMP()
{
this->processedXMP = true; // Make sure we only come through here once.
// Set up everything for the legacy import, but don't do it yet. This lets us do a forced legacy
// import if the XMP packet gets parsing errors.
// ! Photoshop 6 wrote annoyingly wacky TIFF files. It buried a lot of the Exif metadata inside
// ! image resource 1058, itself inside of tag 34377 in the 0th IFD. Take care of this before
// ! doing any of the legacy metadata presence or priority analysis. Delete image resource 1058
// ! to get rid of the buried Exif, but don't mark the XMPFiles object as changed. This change
// ! should not trigger an update, but should be included as part of a normal update.
bool found;
bool readOnly = ((this->parent->openFlags & kXMPFiles_OpenForUpdate) == 0);
if ( readOnly ) {
this->psirMgr = new PSIR_MemoryReader();
this->iptcMgr = new IPTC_Reader();
} else {
this->psirMgr = new PSIR_FileWriter();
this->iptcMgr = new IPTC_Writer(); // ! Parse it later.
}
TIFF_Manager & tiff = this->tiffMgr; // Give the compiler help in recognizing non-aliases.
PSIR_Manager & psir = *this->psirMgr;
IPTC_Manager & iptc = *this->iptcMgr;
TIFF_Manager::TagInfo psirInfo;
bool havePSIR = tiff.GetTag ( kTIFF_PrimaryIFD, kTIFF_PSIR, &psirInfo );
if ( havePSIR ) { // ! Do the Photoshop 6 integration before other legacy analysis.
psir.ParseMemoryResources ( psirInfo.dataPtr, psirInfo.dataLen );
PSIR_Manager::ImgRsrcInfo buriedExif;
found = psir.GetImgRsrc ( kPSIR_Exif, &buriedExif );
if ( found ) {
tiff.IntegrateFromPShop6 ( buriedExif.dataPtr, buriedExif.dataLen );
if ( ! readOnly ) psir.DeleteImgRsrc ( kPSIR_Exif );
}
}
TIFF_Manager::TagInfo iptcInfo;
bool haveIPTC = tiff.GetTag ( kTIFF_PrimaryIFD, kTIFF_IPTC, &iptcInfo ); // The TIFF IPTC tag.
int iptcDigestState = kDigestMatches;
if ( haveIPTC ) {
bool haveDigest = false;
PSIR_Manager::ImgRsrcInfo digestInfo;
if ( havePSIR ) haveDigest = psir.GetImgRsrc ( kPSIR_IPTCDigest, &digestInfo );
if ( digestInfo.dataLen != 16 ) haveDigest = false;
if ( ! haveDigest ) {
iptcDigestState = kDigestMissing;
} else {
// Older versions of Photoshop wrote tag 33723 with type LONG, but ignored the trailing
// zero padding for the IPTC digest. If the full digest differs, recheck without the padding.
iptcDigestState = PhotoDataUtils::CheckIPTCDigest ( iptcInfo.dataPtr, iptcInfo.dataLen, digestInfo.dataPtr );
if ( (iptcDigestState == kDigestDiffers) && (kTIFF_TypeSizes[iptcInfo.type] > 1) ) {
XMP_Uns8 * endPtr = (XMP_Uns8*)iptcInfo.dataPtr + iptcInfo.dataLen - 1;
XMP_Uns8 * minPtr = endPtr - kTIFF_TypeSizes[iptcInfo.type] + 1;
while ( (endPtr >= minPtr) && (*endPtr == 0) ) --endPtr;
iptcDigestState = PhotoDataUtils::CheckIPTCDigest ( iptcInfo.dataPtr, unpaddedLen, digestInfo.dataPtr );
}
}
}
XMP_OptionBits options = k2XMP_FileHadExif; // TIFF files are presumed to have Exif legacy.
if ( haveIPTC ) options |= k2XMP_FileHadIPTC;
if ( this->containsXMP ) options |= k2XMP_FileHadXMP;
// Process the XMP packet. If it fails to parse, do a forced legacy import but still throw an
// exception. This tells the caller that an error happened, but gives them recovered legacy
// should they want to proceed with that.
bool haveXMP = false;
if ( ! this->xmpPacket.empty() ) {
XMP_Assert ( this->containsXMP );
// Common code takes care of packetInfo.charForm, .padSize, and .writeable.
XMP_StringPtr packetStr = this->xmpPacket.c_str();
XMP_StringLen packetLen = (XMP_StringLen)this->xmpPacket.size();
try {
this->xmpObj.ParseFromBuffer ( packetStr, packetLen );
} catch ( ... ) { /* Ignore parsing failures, someday we hope to get partial XMP back. */ }
haveXMP = true;
}
// Process the legacy metadata.
if ( haveIPTC && (! haveXMP) && (iptcDigestState == kDigestMatches) ) iptcDigestState = kDigestMissing;
bool parseIPTC = (iptcDigestState != kDigestMatches) || (! readOnly);
if ( parseIPTC ) iptc.ParseMemoryDataSets ( iptcInfo.dataPtr, iptcInfo.dataLen );
ImportPhotoData ( tiff, iptc, psir, iptcDigestState, &this->xmpObj, options );
this->containsXMP = true; // Assume we now have something in the XMP.
} // TIFF_MetaHandler::ProcessXMP
| 9,659 |
103,348 | 0 | P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {
DCHECK(sockets_.empty());
}
| 9,660 |
180,696 | 1 | set_string_2_svc(sstring_arg *arg, struct svc_req *rqstp)
{
static generic_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
const char *errmsg = NULL;
xdr_free(xdr_generic_ret, &ret);
if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))
goto exit_func;
if ((ret.code = check_handle((void *)handle)))
goto exit_func;
ret.api_version = handle->api_version;
if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {
ret.code = KADM5_FAILURE;
goto exit_func;
}
if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {
ret.code = KADM5_BAD_PRINCIPAL;
goto exit_func;
}
if (CHANGEPW_SERVICE(rqstp)
|| !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_MODIFY,
arg->princ, NULL)) {
ret.code = KADM5_AUTH_MODIFY;
log_unauth("kadm5_mod_strings", prime_arg,
&client_name, &service_name, rqstp);
} else {
ret.code = kadm5_set_string((void *)handle, arg->princ, arg->key,
arg->value);
if (ret.code != 0)
errmsg = krb5_get_error_message(handle->context, ret.code);
log_done("kadm5_mod_strings", prime_arg, errmsg,
&client_name, &service_name, rqstp);
if (errmsg != NULL)
krb5_free_error_message(handle->context, errmsg);
}
free(prime_arg);
gss_release_buffer(&minor_stat, &client_name);
gss_release_buffer(&minor_stat, &service_name);
exit_func:
free_server_handle(handle);
return &ret;
}
| 9,661 |
74,361 | 0 | static VOID ParaNdis_AddDriverOKStatus(PPARANDIS_ADAPTER pContext)
{
pContext->bDeviceInitialized = TRUE;
KeMemoryBarrier();
VirtIODeviceAddStatus(pContext->IODevice, VIRTIO_CONFIG_S_DRIVER_OK);
}
| 9,662 |
78,197 | 0 | authentic_match_card(struct sc_card *card)
{
struct sc_context *ctx = card->ctx;
int i;
sc_log_hex(ctx, "try to match card with ATR", card->atr.value, card->atr.len);
i = _sc_match_atr(card, authentic_known_atrs, &card->type);
if (i < 0) {
sc_log(ctx, "card not matched");
return 0;
}
sc_log(ctx, "'%s' card matched", authentic_known_atrs[i].name);
return 1;
}
| 9,663 |
38,454 | 0 | static void cma_attach_to_dev(struct rdma_id_private *id_priv,
struct cma_device *cma_dev)
{
atomic_inc(&cma_dev->refcount);
id_priv->cma_dev = cma_dev;
id_priv->id.device = cma_dev->device;
id_priv->id.route.addr.dev_addr.transport =
rdma_node_get_transport(cma_dev->device->node_type);
list_add_tail(&id_priv->list, &cma_dev->id_list);
}
| 9,664 |
91,633 | 0 | bgp_attr_flags_diagnose(struct bgp_attr_parser_args *args,
uint8_t desired_flags /* how RFC says it must be */
)
{
uint8_t seen = 0, i;
uint8_t real_flags = args->flags;
const uint8_t attr_code = args->type;
desired_flags &= ~BGP_ATTR_FLAG_EXTLEN;
real_flags &= ~BGP_ATTR_FLAG_EXTLEN;
for (i = 0; i <= 2; i++) /* O,T,P, but not E */
if (CHECK_FLAG(desired_flags, attr_flag_str[i].key)
!= CHECK_FLAG(real_flags, attr_flag_str[i].key)) {
flog_err(EC_BGP_ATTR_FLAG,
"%s attribute must%s be flagged as \"%s\"",
lookup_msg(attr_str, attr_code, NULL),
CHECK_FLAG(desired_flags, attr_flag_str[i].key)
? ""
: " not",
attr_flag_str[i].str);
seen = 1;
}
if (!seen) {
zlog_debug(
"Strange, %s called for attr %s, but no problem found with flags"
" (real flags 0x%x, desired 0x%x)",
__func__, lookup_msg(attr_str, attr_code, NULL),
real_flags, desired_flags);
}
}
| 9,665 |
177,731 | 0 | ProxyResolverV8WithMockBindings(MockJSBindings* mock_js_bindings) :
ProxyResolverV8(mock_js_bindings, mock_js_bindings), mock_js_bindings_(mock_js_bindings) {
}
| 9,666 |
92,593 | 0 | void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
{
int mm_users = 0;
struct mm_struct *mm = p->mm;
if (mm) {
mm_users = atomic_read(&mm->mm_users);
if (mm_users == 1) {
mm->numa_next_scan = jiffies + msecs_to_jiffies(sysctl_numa_balancing_scan_delay);
mm->numa_scan_seq = 0;
}
}
p->node_stamp = 0;
p->numa_scan_seq = mm ? mm->numa_scan_seq : 0;
p->numa_scan_period = sysctl_numa_balancing_scan_delay;
p->numa_work.next = &p->numa_work;
p->numa_faults = NULL;
p->numa_group = NULL;
p->last_task_numa_placement = 0;
p->last_sum_exec_runtime = 0;
/* New address space, reset the preferred nid */
if (!(clone_flags & CLONE_VM)) {
p->numa_preferred_nid = -1;
return;
}
/*
* New thread, keep existing numa_preferred_nid which should be copied
* already by arch_dup_task_struct but stagger when scans start.
*/
if (mm) {
unsigned int delay;
delay = min_t(unsigned int, task_scan_max(current),
current->numa_scan_period * mm_users * NSEC_PER_MSEC);
delay += 2 * TICK_NSEC;
p->node_stamp = delay;
}
}
| 9,667 |
62,760 | 0 | static rsRetVal validateConfig(instanceConf_t* info) {
if (info->type == -1) {
errmsg.LogError(0, RS_RET_INVALID_PARAMS,
"you entered an invalid type");
return RS_RET_INVALID_PARAMS;
}
if (info->action == -1) {
errmsg.LogError(0, RS_RET_INVALID_PARAMS,
"you entered an invalid action");
return RS_RET_INVALID_PARAMS;
}
if (info->description == NULL) {
errmsg.LogError(0, RS_RET_INVALID_PARAMS,
"you didn't enter a description");
return RS_RET_INVALID_PARAMS;
}
if(info->type == ZMQ_SUB && info->subscriptions == NULL) {
errmsg.LogError(0, RS_RET_INVALID_PARAMS,
"SUB sockets need a subscription");
return RS_RET_INVALID_PARAMS;
}
if(info->type != ZMQ_SUB && info->subscriptions != NULL) {
errmsg.LogError(0, RS_RET_INVALID_PARAMS,
"only SUB sockets can have subscriptions");
return RS_RET_INVALID_PARAMS;
}
return RS_RET_OK;
}
| 9,668 |
168,501 | 0 | String FileReaderLoader::StringResult() {
DCHECK_NE(read_type_, kReadAsArrayBuffer);
DCHECK_NE(read_type_, kReadByClient);
if (!raw_data_ || error_code_ || is_raw_data_converted_)
return string_result_;
switch (read_type_) {
case kReadAsArrayBuffer:
return string_result_;
case kReadAsBinaryString:
SetStringResult(raw_data_->ToString());
break;
case kReadAsText:
SetStringResult(ConvertToText());
break;
case kReadAsDataURL:
if (finished_loading_)
SetStringResult(ConvertToDataURL());
break;
default:
NOTREACHED();
}
if (finished_loading_) {
DCHECK(is_raw_data_converted_);
AdjustReportedMemoryUsageToV8(
-1 * static_cast<int64_t>(raw_data_->ByteLength()));
raw_data_.reset();
}
return string_result_;
}
| 9,669 |
126,235 | 0 | bool Browser::ShouldCloseWindow() {
if (!CanCloseWithInProgressDownloads())
return false;
return unload_controller_->ShouldCloseWindow();
}
| 9,670 |
129,145 | 0 | void Framebuffer::AttachRenderbuffer(
GLenum attachment, Renderbuffer* renderbuffer) {
const Attachment* a = GetAttachment(attachment);
if (a)
a->DetachFromFramebuffer(this);
if (renderbuffer) {
attachments_[attachment] = scoped_refptr<Attachment>(
new RenderbufferAttachment(renderbuffer));
} else {
attachments_.erase(attachment);
}
framebuffer_complete_state_count_id_ = 0;
}
| 9,671 |
41,500 | 0 | static int dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
int err;
lock_sock(sk);
err = __dn_setsockopt(sock, level, optname, optval, optlen, 0);
release_sock(sk);
return err;
}
| 9,672 |
106,214 | 0 | void setJSTestObjLongSequenceAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
impl->setLongSequenceAttr(toNativeArray<long>(exec, value));
}
| 9,673 |
51,408 | 0 | static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, int vert)
{
int dashStep = *dashStepP;
int on = *onP;
int w, wstart;
dashStep++;
if (dashStep == gdDashSize) {
dashStep = 0;
on = !on;
}
if (on) {
if (vert) {
wstart = y - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel(im, x, w, color);
}
} else {
wstart = x - wid / 2;
for (w = wstart; w < wstart + wid; w++) {
gdImageSetPixel(im, w, y, color);
}
}
}
*dashStepP = dashStep;
*onP = on;
}
| 9,674 |
28,859 | 0 | int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE;
}
| 9,675 |
158,798 | 0 | const std::vector<mojom::ResourceLoadInfoPtr>& resource_load_infos() const {
return resource_load_infos_;
}
| 9,676 |
142,476 | 0 | void ShelfLayoutManager::ProcessGestureEventOfAutoHideShelf(
ui::GestureEvent* event,
aura::Window* target) {
const bool is_shelf_window = IsShelfWindow(target);
if (IsVisible() || in_shutdown_) {
if (!is_shelf_window && !IsStatusAreaWindow(target) &&
visibility_state() == SHELF_AUTO_HIDE &&
state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN &&
event->type() == ui::ET_GESTURE_TAP) {
UpdateAutoHideState();
}
return;
}
if (is_shelf_window) {
ui::GestureEvent event_in_screen(*event);
gfx::Point location_in_screen(event->location());
::wm::ConvertPointToScreen(target, &location_in_screen);
event_in_screen.set_location(location_in_screen);
if (ProcessGestureEvent(event_in_screen))
event->StopPropagation();
}
}
| 9,677 |
157,891 | 0 | blink::WebString RenderViewImpl::AcceptLanguages() {
return WebString::FromUTF8(renderer_preferences_.accept_languages);
}
| 9,678 |
153,378 | 0 | TabStrip::DropArrow::DropArrow(const BrowserRootView::DropIndex& index,
bool point_down,
views::Widget* context)
: index(index), point_down(point_down) {
arrow_view = new views::ImageView;
arrow_view->SetImage(GetDropArrowImage(point_down));
arrow_window = new views::Widget;
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
params.keep_on_top = true;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.accept_events = false;
params.bounds = gfx::Rect(g_drop_indicator_width, g_drop_indicator_height);
params.context = context->GetNativeWindow();
arrow_window->Init(params);
arrow_window->SetContentsView(arrow_view);
}
| 9,679 |
138,527 | 0 | static Mutex& threadSetMutex()
{
AtomicallyInitializedStaticReference(Mutex, mutex, new Mutex);
return mutex;
}
| 9,680 |
7,128 | 0 | t42_glyphslot_clear( FT_GlyphSlot slot )
{
/* free bitmap if needed */
ft_glyphslot_free_bitmap( slot );
/* clear all public fields in the glyph slot */
FT_ZERO( &slot->metrics );
FT_ZERO( &slot->outline );
FT_ZERO( &slot->bitmap );
slot->bitmap_left = 0;
slot->bitmap_top = 0;
slot->num_subglyphs = 0;
slot->subglyphs = 0;
slot->control_data = 0;
slot->control_len = 0;
slot->other = 0;
slot->format = FT_GLYPH_FORMAT_NONE;
slot->linearHoriAdvance = 0;
slot->linearVertAdvance = 0;
}
| 9,681 |
153,626 | 0 | void GLES2Implementation::DestroyGpuFenceCHROMIUMHelper(GLuint client_id) {
if (GetIdAllocator(IdNamespaces::kGpuFences)->InUse(client_id)) {
GetIdAllocator(IdNamespaces::kGpuFences)->FreeID(client_id);
helper_->DestroyGpuFenceCHROMIUM(client_id);
} else {
SetGLError(GL_INVALID_VALUE, "glDestroyGpuFenceCHROMIUM",
"id not created by this context.");
}
}
| 9,682 |
60,714 | 0 | static inline void tower_delete (struct lego_usb_tower *dev)
{
tower_abort_transfers (dev);
/* free data structures */
usb_free_urb(dev->interrupt_in_urb);
usb_free_urb(dev->interrupt_out_urb);
kfree (dev->read_buffer);
kfree (dev->interrupt_in_buffer);
kfree (dev->interrupt_out_buffer);
kfree (dev);
}
| 9,683 |
125,418 | 0 | void GDataFileSystem::OnMarkDirtyInCacheCompleteForOpenFile(
const OpenFileCallback& callback,
GDataFileError error,
const std::string& resource_id,
const std::string& md5,
const FilePath& cache_file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!callback.is_null())
callback.Run(error, cache_file_path);
}
| 9,684 |
152,535 | 0 | bool RenderFrameImpl::ShouldReportDetailedMessageForSource(
const blink::WebString& source) {
return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource(
source.Utf16());
}
| 9,685 |
71,044 | 0 | void* Type_S15Fixed16_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n)
{
return _cmsDupMem(self ->ContextID, Ptr, n * sizeof(cmsFloat64Number));
}
| 9,686 |
13 | 0 | static int samldb_generate_sAMAccountName(struct ldb_context *ldb,
struct ldb_message *msg)
{
char *name;
/* Format: $000000-000000000000 */
name = talloc_asprintf(msg, "$%.6X-%.6X%.6X",
(unsigned int)generate_random(),
(unsigned int)generate_random(),
(unsigned int)generate_random());
if (name == NULL) {
return ldb_oom(ldb);
}
return ldb_msg_add_steal_string(msg, "sAMAccountName", name);
}
| 9,687 |
153,732 | 0 | void GLES2Implementation::GetUniformBlocksCHROMIUM(GLuint program,
GLsizei bufsize,
GLsizei* size,
void* info) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
if (bufsize < 0) {
SetGLError(GL_INVALID_VALUE, "glGetUniformBlocksCHROMIUM",
"bufsize less than 0.");
return;
}
if (size == nullptr) {
SetGLError(GL_INVALID_VALUE, "glGetUniformBlocksCHROMIUM", "size is null.");
return;
}
DCHECK_EQ(0, *size);
std::vector<int8_t> result;
GetUniformBlocksCHROMIUMHelper(program, &result);
if (result.empty()) {
return;
}
*size = result.size();
if (!info) {
return;
}
if (static_cast<size_t>(bufsize) < result.size()) {
SetGLError(GL_INVALID_OPERATION, "glGetUniformBlocksCHROMIUM",
"bufsize is too small for result.");
return;
}
memcpy(info, &result[0], result.size());
}
| 9,688 |
162,910 | 0 | void CoordinatorImpl::RequestGlobalMemoryDumpInternal(
const QueuedRequest::Args& args,
const RequestGlobalMemoryDumpInternalCallback& callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
UMA_HISTOGRAM_COUNTS_1000("Memory.Experimental.Debug.GlobalDumpQueueLength",
queued_memory_dump_requests_.size());
bool another_dump_is_queued = !queued_memory_dump_requests_.empty();
if (another_dump_is_queued &&
(args.dump_type == MemoryDumpType::PERIODIC_INTERVAL ||
args.dump_type == MemoryDumpType::PEAK_MEMORY_USAGE)) {
for (const auto& request : queued_memory_dump_requests_) {
if (request.args.level_of_detail == args.level_of_detail) {
VLOG(1) << "RequestGlobalMemoryDump("
<< base::trace_event::MemoryDumpTypeToString(args.dump_type)
<< ") skipped because another dump request with the same "
"level of detail ("
<< base::trace_event::MemoryDumpLevelOfDetailToString(
args.level_of_detail)
<< ") is already in the queue";
callback.Run(false /* success */, 0 /* dump_guid */,
nullptr /* global_memory_dump */);
return;
}
}
}
queued_memory_dump_requests_.emplace_back(args, ++next_dump_id_, callback);
if (another_dump_is_queued)
return;
PerformNextQueuedGlobalMemoryDump();
}
| 9,689 |
61,396 | 0 | static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set_int(&c->fc->metadata, key, avio_r8(pb), 0);
return 0;
}
| 9,690 |
30,190 | 0 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip)
{
__ftrace_ops_list_func(ip, parent_ip, NULL, NULL);
}
| 9,691 |
150,705 | 0 | base::string16 PageInfoUI::PermissionActionToUIString(
Profile* profile,
ContentSettingsType type,
ContentSetting setting,
ContentSetting default_setting,
content_settings::SettingSource source) {
ContentSetting effective_setting =
GetEffectiveSetting(profile, type, setting, default_setting);
const int* button_text_ids = NULL;
switch (source) {
case content_settings::SETTING_SOURCE_USER:
if (setting == CONTENT_SETTING_DEFAULT) {
#if !defined(OS_ANDROID)
if (type == CONTENT_SETTINGS_TYPE_SOUND &&
base::FeatureList::IsEnabled(media::kAutoplayWhitelistSettings)) {
if (profile->GetPrefs()->GetBoolean(prefs::kBlockAutoplayEnabled) &&
effective_setting == ContentSetting::CONTENT_SETTING_ALLOW) {
return l10n_util::GetStringUTF16(
IDS_PAGE_INFO_BUTTON_TEXT_AUTOMATIC_BY_DEFAULT);
}
button_text_ids = kSoundPermissionButtonTextIDDefaultSetting;
break;
}
#endif
button_text_ids = kPermissionButtonTextIDDefaultSetting;
break;
}
FALLTHROUGH;
case content_settings::SETTING_SOURCE_POLICY:
case content_settings::SETTING_SOURCE_EXTENSION:
#if !defined(OS_ANDROID)
if (type == CONTENT_SETTINGS_TYPE_SOUND &&
base::FeatureList::IsEnabled(media::kAutoplayWhitelistSettings)) {
button_text_ids = kSoundPermissionButtonTextIDUserManaged;
break;
}
#endif
button_text_ids = kPermissionButtonTextIDUserManaged;
break;
case content_settings::SETTING_SOURCE_WHITELIST:
case content_settings::SETTING_SOURCE_NONE:
default:
NOTREACHED();
return base::string16();
}
int button_text_id = button_text_ids[effective_setting];
DCHECK_NE(button_text_id, kInvalidResourceID);
return l10n_util::GetStringUTF16(button_text_id);
}
| 9,692 |
137,225 | 0 | bool Textfield::GetWordLookupDataFromSelection(
gfx::DecoratedText* decorated_text,
gfx::Point* baseline_point) {
return GetRenderText()->GetLookupDataForRange(GetRenderText()->selection(),
decorated_text, baseline_point);
}
| 9,693 |
34,305 | 0 | static int btrfs_getattr(struct vfsmount *mnt,
struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
u32 blocksize = inode->i_sb->s_blocksize;
generic_fillattr(inode, stat);
stat->dev = BTRFS_I(inode)->root->anon_dev;
stat->blksize = PAGE_CACHE_SIZE;
stat->blocks = (ALIGN(inode_get_bytes(inode), blocksize) +
ALIGN(BTRFS_I(inode)->delalloc_bytes, blocksize)) >> 9;
return 0;
}
| 9,694 |
90,455 | 0 | static __poll_t ib_uverbs_event_poll(struct ib_uverbs_event_queue *ev_queue,
struct file *filp,
struct poll_table_struct *wait)
{
__poll_t pollflags = 0;
poll_wait(filp, &ev_queue->poll_wait, wait);
spin_lock_irq(&ev_queue->lock);
if (!list_empty(&ev_queue->event_list))
pollflags = EPOLLIN | EPOLLRDNORM;
spin_unlock_irq(&ev_queue->lock);
return pollflags;
}
| 9,695 |
131,782 | 0 | static void testInterfaceEmptyAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
V8TRYCATCH_VOID(TestInterfaceEmpty*, cppValue, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), jsValue));
imp->setTestInterfaceEmptyAttribute(WTF::getPtr(cppValue));
}
| 9,696 |
150,217 | 0 | void TabletModeWindowManager::OnWindowHierarchyChanged(
const HierarchyChangeParams& params) {
if (params.new_parent && IsContainerWindow(params.new_parent) &&
!base::Contains(window_state_map_, params.target)) {
if (!params.target->IsVisible()) {
if (!base::Contains(added_windows_, params.target)) {
added_windows_.insert(params.target);
params.target->AddObserver(this);
}
return;
}
TrackWindow(params.target);
if (base::Contains(window_state_map_, params.target)) {
wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
wm::GetWindowState(params.target)->OnWMEvent(&event);
}
}
}
| 9,697 |
145,171 | 0 | void OnGpuProcessHostDestroyedOnUI(int host_id, const std::string& message) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
GpuDataManagerImpl::GetInstance()->AddLogMessage(
logging::LOG_ERROR, "GpuProcessHostUIShim", message);
#if defined(USE_OZONE)
ui::OzonePlatform::GetInstance()
->GetGpuPlatformSupportHost()
->OnChannelDestroyed(host_id);
#endif
}
| 9,698 |
146,219 | 0 | void WebGL2RenderingContextBase::uniformMatrix2x4fv(
const WebGLUniformLocation* location,
GLboolean transpose,
MaybeShared<DOMFloat32Array> value,
GLuint src_offset,
GLuint src_length) {
if (isContextLost() || !ValidateUniformMatrixParameters(
"uniformMatrix2x4fv", location, transpose,
value.View(), 8, src_offset, src_length))
return;
ContextGL()->UniformMatrix2x4fv(
location->Location(),
(src_length ? src_length : (value.View()->length() - src_offset)) >> 3,
transpose, value.View()->DataMaybeShared() + src_offset);
}
| 9,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.