unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
1,110 | 0 | GfxState *GfxState::restore() {
GfxState *oldState;
if (saved) {
oldState = saved;
oldState->path = path;
oldState->curX = curX;
oldState->curY = curY;
oldState->lineX = lineX;
oldState->lineY = lineY;
path = NULL;
saved = NULL;
delete this;
} else {
oldState = this;
}
return oldState;
}
| 4,900 |
12,729 | 0 | static int version_cmp(const SSL *s, int a, int b)
{
int dtls = SSL_IS_DTLS(s);
if (a == b)
return 0;
if (!dtls)
return a < b ? -1 : 1;
return DTLS_VERSION_LT(a, b) ? -1 : 1;
}
| 4,901 |
81,058 | 0 | vmx_restore_control_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data)
{
u64 supported;
u32 *lowp, *highp;
switch (msr_index) {
case MSR_IA32_VMX_TRUE_PINBASED_CTLS:
lowp = &vmx->nested.msrs.pinbased_ctls_low;
highp = &vmx->nested.msrs.pinbased_ctls_high;
break;
case MSR_IA32_VMX_TRUE_PROCBASED_CTLS:
lowp = &vmx->nested.msrs.procbased_ctls_low;
highp = &vmx->nested.msrs.procbased_ctls_high;
break;
case MSR_IA32_VMX_TRUE_EXIT_CTLS:
lowp = &vmx->nested.msrs.exit_ctls_low;
highp = &vmx->nested.msrs.exit_ctls_high;
break;
case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
lowp = &vmx->nested.msrs.entry_ctls_low;
highp = &vmx->nested.msrs.entry_ctls_high;
break;
case MSR_IA32_VMX_PROCBASED_CTLS2:
lowp = &vmx->nested.msrs.secondary_ctls_low;
highp = &vmx->nested.msrs.secondary_ctls_high;
break;
default:
BUG();
}
supported = vmx_control_msr(*lowp, *highp);
/* Check must-be-1 bits are still 1. */
if (!is_bitwise_subset(data, supported, GENMASK_ULL(31, 0)))
return -EINVAL;
/* Check must-be-0 bits are still 0. */
if (!is_bitwise_subset(supported, data, GENMASK_ULL(63, 32)))
return -EINVAL;
*lowp = data;
*highp = data >> 32;
return 0;
}
| 4,902 |
169,971 | 0 | profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent)
{
int i;
if (templ->templMax == 0) {
templ->templMax = 4;
templ->templCalledTab =
(xsltTemplatePtr *) xmlMalloc(templ->templMax *
sizeof(templ->templCalledTab[0]));
templ->templCountTab =
(int *) xmlMalloc(templ->templMax *
sizeof(templ->templCountTab[0]));
if (templ->templCalledTab == NULL || templ->templCountTab == NULL) {
xmlGenericError(xmlGenericErrorContext, "malloc failed !\n");
return;
}
}
else if (templ->templNr >= templ->templMax) {
templ->templMax *= 2;
templ->templCalledTab =
(xsltTemplatePtr *) xmlRealloc(templ->templCalledTab,
templ->templMax *
sizeof(templ->templCalledTab[0]));
templ->templCountTab =
(int *) xmlRealloc(templ->templCountTab,
templ->templMax *
sizeof(templ->templCountTab[0]));
if (templ->templCalledTab == NULL || templ->templCountTab == NULL) {
xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
return;
}
}
for (i = 0; i < templ->templNr; i++) {
if (templ->templCalledTab[i] == parent) {
templ->templCountTab[i]++;
break;
}
}
if (i == templ->templNr) {
/* not found, add new one */
templ->templCalledTab[templ->templNr] = parent;
templ->templCountTab[templ->templNr] = 1;
templ->templNr++;
}
}
| 4,903 |
110,978 | 0 | void RootWindowHostWin::OnPaint(HDC dc) {
root_window_->Draw();
ValidateRect(hwnd(), NULL);
}
| 4,904 |
111,351 | 0 | void WebPage::setInitialScale(double initialScale)
{
d->setInitialScale(initialScale);
}
| 4,905 |
129,832 | 0 | void TraceEvent::Reset() {
duration_ = TimeDelta::FromInternalValue(-1);
parameter_copy_storage_ = NULL;
for (int i = 0; i < kTraceMaxNumArgs; ++i)
convertable_values_[i] = NULL;
}
| 4,906 |
58,378 | 0 | static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
unsigned long top)
{
unsigned long first;
mm_segment_t fs;
int i;
/*
* We need to switch to kernel mode so that we can use __get_user
* to safely read from kernel space. Note that we now dump the
* code first, just in case the backtrace kills us.
*/
fs = get_fs();
set_fs(KERNEL_DS);
printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top);
for (first = bottom & ~31; first < top; first += 32) {
unsigned long p;
char str[sizeof(" 12345678") * 8 + 1];
memset(str, ' ', sizeof(str));
str[sizeof(str) - 1] = '\0';
for (p = first, i = 0; i < 8 && p < top; i++, p += 4) {
if (p >= bottom && p < top) {
unsigned long val;
if (__get_user(val, (unsigned long *)p) == 0)
sprintf(str + i * 9, " %08lx", val);
else
sprintf(str + i * 9, " ????????");
}
}
printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
}
set_fs(fs);
}
| 4,907 |
127,368 | 0 | void StyleResolver::applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count, RenderStyle* style)
{
StyleResolverState state(document(), document().documentElement(), style);
state.setStyle(style);
state.fontBuilder().initForStyleResolve(document(), style, state.useSVGZoomRules());
for (size_t i = 0; i < count; ++i) {
if (properties[i].value) {
switch (properties[i].property) {
case CSSPropertyFontSize:
case CSSPropertyLineHeight:
updateFont(state);
break;
default:
break;
}
StyleBuilder::applyProperty(properties[i].property, state, properties[i].value);
}
}
}
| 4,908 |
137,064 | 0 | ChromeClient* InputType::GetChromeClient() const {
if (Page* page = GetElement().GetDocument().GetPage())
return &page->GetChromeClient();
return nullptr;
}
| 4,909 |
126,079 | 0 | BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() {
}
| 4,910 |
163,873 | 0 | void DevToolsWindow::HandleKeyboardEvent(
WebContents* source,
const content::NativeWebKeyboardEvent& event) {
if (event.windows_key_code == 0x08) {
return;
}
BrowserWindow* inspected_window = GetInspectedBrowserWindow();
if (inspected_window)
inspected_window->HandleKeyboardEvent(event);
}
| 4,911 |
67,811 | 0 | static int xfrm_dump_policy_done(struct netlink_callback *cb)
{
struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
struct net *net = sock_net(cb->skb->sk);
xfrm_policy_walk_done(walk, net);
return 0;
}
| 4,912 |
168,407 | 0 | ui::WindowShowState TestBrowserWindow::GetRestoredState() const {
return ui::SHOW_STATE_DEFAULT;
}
| 4,913 |
140,137 | 0 | void HTMLMediaElement::updateControlsVisibility() {
if (!isConnected()) {
if (mediaControls())
mediaControls()->hide();
return;
}
ensureMediaControls();
mediaControls()->reset();
if (shouldShowControls(RecordMetricsBehavior::DoRecord))
mediaControls()->show();
else
mediaControls()->hide();
}
| 4,914 |
24,425 | 0 | int proc_dointvec_minmax(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct do_proc_dointvec_minmax_conv_param param = {
.min = (int *) table->extra1,
.max = (int *) table->extra2,
};
return do_proc_dointvec(table, write, buffer, lenp, ppos,
do_proc_dointvec_minmax_conv, ¶m);
}
| 4,915 |
87,970 | 0 | static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr)
{
char rc_cmd[12] = { 0x25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
struct pcd_unit *cd = cdi->handle;
if (pcd_ready_wait(cd, PCD_READY_TMO))
return CDS_DRIVE_NOT_READY;
if (pcd_atapi(cd, rc_cmd, 8, pcd_scratch, DBMSG("check media")))
return CDS_NO_DISC;
return CDS_DISC_OK;
}
| 4,916 |
169,126 | 0 | static bool TokenExitsInSelect(const CompactHTMLToken& token) {
const String& tag_name = token.Data();
return ThreadSafeMatch(tag_name, inputTag) ||
ThreadSafeMatch(tag_name, keygenTag) ||
ThreadSafeMatch(tag_name, textareaTag);
}
| 4,917 |
133,911 | 0 | ValidityState* FormAssociatedElement::validity()
{
if (!m_validityState)
m_validityState = ValidityState::create(this);
return m_validityState.get();
}
| 4,918 |
165,048 | 0 | bool HTMLCanvasElement::WouldTaintOrigin() const {
return !OriginClean();
}
| 4,919 |
58,946 | 0 | static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned long *val)
{
struct l2cap_conf_opt *opt = *ptr;
int len;
len = L2CAP_CONF_OPT_SIZE + opt->len;
*ptr += len;
*type = opt->type;
*olen = opt->len;
switch (opt->len) {
case 1:
*val = *((u8 *) opt->val);
break;
case 2:
*val = __le16_to_cpu(*((__le16 *) opt->val));
break;
case 4:
*val = __le32_to_cpu(*((__le32 *) opt->val));
break;
default:
*val = (unsigned long) opt->val;
break;
}
BT_DBG("type 0x%2.2x len %d val 0x%lx", *type, opt->len, *val);
return len;
}
| 4,920 |
121,411 | 0 | GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
const GURL& base_url,
DevToolsDockSide dock_side,
bool shared_worker_frontend,
bool external_frontend) {
if (base_url.SchemeIs("data"))
return base_url;
std::string frontend_url(
base_url.is_empty() ? chrome::kChromeUIDevToolsURL : base_url.spec());
ThemeService* tp = ThemeServiceFactory::GetForProfile(profile);
DCHECK(tp);
std::string url_string(
frontend_url +
((frontend_url.find("?") == std::string::npos) ? "?" : "&") +
"dockSide=" + SideToString(dock_side) +
"&toolbarColor=" +
SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_TOOLBAR)) +
"&textColor=" +
SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)));
if (shared_worker_frontend)
url_string += "&isSharedWorker=true";
if (external_frontend)
url_string += "&remoteFrontend=true";
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableDevToolsExperiments))
url_string += "&experiments=true";
url_string += "&updateAppcache";
return GURL(url_string);
}
| 4,921 |
66,432 | 0 | static inline bool use_goto_tb(DisasContext *s, target_ulong pc)
{
#ifndef CONFIG_USER_ONLY
return (pc & TARGET_PAGE_MASK) == (s->tb->pc & TARGET_PAGE_MASK) ||
(pc & TARGET_PAGE_MASK) == (s->pc_start & TARGET_PAGE_MASK);
#else
return true;
#endif
}
| 4,922 |
61,997 | 0 | ikev1_print(netdissect_options *ndo,
const u_char *bp, u_int length,
const u_char *bp2, struct isakmp *base)
{
const struct isakmp *p;
const u_char *ep;
u_char np;
int i;
int phase;
p = (const struct isakmp *)bp;
ep = ndo->ndo_snapend;
phase = (EXTRACT_32BITS(base->msgid) == 0) ? 1 : 2;
if (phase == 1)
ND_PRINT((ndo," phase %d", phase));
else
ND_PRINT((ndo," phase %d/others", phase));
i = cookie_find(&base->i_ck);
if (i < 0) {
if (iszero((const u_char *)&base->r_ck, sizeof(base->r_ck))) {
/* the first packet */
ND_PRINT((ndo," I"));
if (bp2)
cookie_record(&base->i_ck, bp2);
} else
ND_PRINT((ndo," ?"));
} else {
if (bp2 && cookie_isinitiator(i, bp2))
ND_PRINT((ndo," I"));
else if (bp2 && cookie_isresponder(i, bp2))
ND_PRINT((ndo," R"));
else
ND_PRINT((ndo," ?"));
}
ND_PRINT((ndo," %s", ETYPESTR(base->etype)));
if (base->flags) {
ND_PRINT((ndo,"[%s%s]", base->flags & ISAKMP_FLAG_E ? "E" : "",
base->flags & ISAKMP_FLAG_C ? "C" : ""));
}
if (ndo->ndo_vflag) {
const struct isakmp_gen *ext;
ND_PRINT((ndo,":"));
/* regardless of phase... */
if (base->flags & ISAKMP_FLAG_E) {
/*
* encrypted, nothing we can do right now.
* we hope to decrypt the packet in the future...
*/
ND_PRINT((ndo," [encrypted %s]", NPSTR(base->np)));
goto done;
}
CHECKLEN(p + 1, base->np);
np = base->np;
ext = (const struct isakmp_gen *)(p + 1);
ikev1_sub_print(ndo, np, ext, ep, phase, 0, 0, 0);
}
done:
if (ndo->ndo_vflag) {
if (ntohl(base->len) != length) {
ND_PRINT((ndo," (len mismatch: isakmp %u/ip %u)",
(uint32_t)ntohl(base->len), length));
}
}
}
| 4,923 |
166,712 | 0 | void ThreadHeap::VerifyMarking() {
for (int i = 0; i < BlinkGC::kNumberOfArenas; ++i) {
arenas_[i]->VerifyMarking();
}
}
| 4,924 |
128,171 | 0 | void PluginDataRemover::GetSupportedPlugins(
std::vector<WebPluginInfo>* supported_plugins) {
bool allow_wildcard = false;
std::vector<WebPluginInfo> plugins;
PluginService::GetInstance()->GetPluginInfoArray(
GURL(), kFlashPluginSwfMimeType, allow_wildcard, &plugins, NULL);
Version min_version(kMinFlashVersion);
for (std::vector<WebPluginInfo>::iterator it = plugins.begin();
it != plugins.end(); ++it) {
Version version;
WebPluginInfo::CreateVersionFromString(it->version, &version);
if (version.IsValid() && min_version.CompareTo(version) == -1)
supported_plugins->push_back(*it);
}
}
| 4,925 |
40,083 | 0 | int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
{
struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
struct compat_cmsghdr cmhdr;
struct compat_timeval ctv;
struct compat_timespec cts[3];
int cmlen;
if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) {
kmsg->msg_flags |= MSG_CTRUNC;
return 0; /* XXX: return error? check spec. */
}
if (!COMPAT_USE_64BIT_TIME) {
if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
struct timeval *tv = (struct timeval *)data;
ctv.tv_sec = tv->tv_sec;
ctv.tv_usec = tv->tv_usec;
data = &ctv;
len = sizeof(ctv);
}
if (level == SOL_SOCKET &&
(type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) {
int count = type == SCM_TIMESTAMPNS ? 1 : 3;
int i;
struct timespec *ts = (struct timespec *)data;
for (i = 0; i < count; i++) {
cts[i].tv_sec = ts[i].tv_sec;
cts[i].tv_nsec = ts[i].tv_nsec;
}
data = &cts;
len = sizeof(cts[0]) * count;
}
}
cmlen = CMSG_COMPAT_LEN(len);
if (kmsg->msg_controllen < cmlen) {
kmsg->msg_flags |= MSG_CTRUNC;
cmlen = kmsg->msg_controllen;
}
cmhdr.cmsg_level = level;
cmhdr.cmsg_type = type;
cmhdr.cmsg_len = cmlen;
if (copy_to_user(cm, &cmhdr, sizeof cmhdr))
return -EFAULT;
if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr)))
return -EFAULT;
cmlen = CMSG_COMPAT_SPACE(len);
if (kmsg->msg_controllen < cmlen)
cmlen = kmsg->msg_controllen;
kmsg->msg_control += cmlen;
kmsg->msg_controllen -= cmlen;
return 0;
}
| 4,926 |
154,734 | 0 | error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap,
uint32_t* result) {
*result = api()->glIsEnabledFn(cap);
return error::kNoError;
}
| 4,927 |
63,943 | 0 | static void reinit_tables(SCPRContext *s)
{
int comp, i, j;
for (comp = 0; comp < 3; comp++) {
for (j = 0; j < 4096; j++) {
if (s->pixel_model[comp][j].total_freq != 256) {
for (i = 0; i < 256; i++)
s->pixel_model[comp][j].freq[i] = 1;
for (i = 0; i < 16; i++)
s->pixel_model[comp][j].lookup[i] = 16;
s->pixel_model[comp][j].total_freq = 256;
}
}
}
for (j = 0; j < 6; j++) {
unsigned *p = s->run_model[j];
for (i = 0; i < 256; i++)
p[i] = 1;
p[256] = 256;
}
for (j = 0; j < 6; j++) {
unsigned *op = s->op_model[j];
for (i = 0; i < 6; i++)
op[i] = 1;
op[6] = 6;
}
for (i = 0; i < 256; i++) {
s->range_model[i] = 1;
s->count_model[i] = 1;
}
s->range_model[256] = 256;
s->count_model[256] = 256;
for (i = 0; i < 5; i++) {
s->fill_model[i] = 1;
}
s->fill_model[5] = 5;
for (j = 0; j < 4; j++) {
for (i = 0; i < 16; i++) {
s->sxy_model[j][i] = 1;
}
s->sxy_model[j][16] = 16;
}
for (i = 0; i < 512; i++) {
s->mv_model[0][i] = 1;
s->mv_model[1][i] = 1;
}
s->mv_model[0][512] = 512;
s->mv_model[1][512] = 512;
}
| 4,928 |
93,642 | 0 | nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port)
{
struct nvmet_fc_tgtport *tgtport = targetport_to_tgtport(target_port);
/* terminate any outstanding associations */
__nvmet_fc_free_assocs(tgtport);
nvmet_fc_tgtport_put(tgtport);
return 0;
}
| 4,929 |
122,685 | 0 | bool Extension::LoadLaunchContainer(string16* error) {
Value* tmp_launcher_container = NULL;
if (!manifest_->Get(keys::kLaunchContainer, &tmp_launcher_container))
return true;
std::string launch_container_string;
if (!tmp_launcher_container->GetAsString(&launch_container_string)) {
*error = ASCIIToUTF16(errors::kInvalidLaunchContainer);
return false;
}
if (launch_container_string == values::kLaunchContainerPanel) {
launch_container_ = extension_misc::LAUNCH_PANEL;
} else if (launch_container_string == values::kLaunchContainerTab) {
launch_container_ = extension_misc::LAUNCH_TAB;
} else {
*error = ASCIIToUTF16(errors::kInvalidLaunchContainer);
return false;
}
bool can_specify_initial_size =
launch_container_ == extension_misc::LAUNCH_PANEL ||
launch_container_ == extension_misc::LAUNCH_WINDOW;
if (!ReadLaunchDimension(manifest_.get(),
keys::kLaunchWidth,
&launch_width_,
can_specify_initial_size,
error)) {
return false;
}
if (!ReadLaunchDimension(manifest_.get(),
keys::kLaunchHeight,
&launch_height_,
can_specify_initial_size,
error)) {
return false;
}
return true;
}
| 4,930 |
21,471 | 0 | static unsigned long vma_dump_size(struct vm_area_struct *vma,
unsigned long mm_flags)
{
#define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type))
/* The vma can be set up to tell us the answer directly. */
if (vma->vm_flags & VM_ALWAYSDUMP)
goto whole;
/* Hugetlb memory check */
if (vma->vm_flags & VM_HUGETLB) {
if ((vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_SHARED))
goto whole;
if (!(vma->vm_flags & VM_SHARED) && FILTER(HUGETLB_PRIVATE))
goto whole;
}
/* Do not dump I/O mapped devices or special mappings */
if (vma->vm_flags & (VM_IO | VM_RESERVED))
return 0;
/* By default, dump shared memory if mapped from an anonymous file. */
if (vma->vm_flags & VM_SHARED) {
if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED))
goto whole;
return 0;
}
/* Dump segments that have been written to. */
if (vma->anon_vma && FILTER(ANON_PRIVATE))
goto whole;
if (vma->vm_file == NULL)
return 0;
if (FILTER(MAPPED_PRIVATE))
goto whole;
/*
* If this looks like the beginning of a DSO or executable mapping,
* check for an ELF header. If we find one, dump the first page to
* aid in determining what was mapped here.
*/
if (FILTER(ELF_HEADERS) &&
vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) {
u32 __user *header = (u32 __user *) vma->vm_start;
u32 word;
mm_segment_t fs = get_fs();
/*
* Doing it this way gets the constant folded by GCC.
*/
union {
u32 cmp;
char elfmag[SELFMAG];
} magic;
BUILD_BUG_ON(SELFMAG != sizeof word);
magic.elfmag[EI_MAG0] = ELFMAG0;
magic.elfmag[EI_MAG1] = ELFMAG1;
magic.elfmag[EI_MAG2] = ELFMAG2;
magic.elfmag[EI_MAG3] = ELFMAG3;
/*
* Switch to the user "segment" for get_user(),
* then put back what elf_core_dump() had in place.
*/
set_fs(USER_DS);
if (unlikely(get_user(word, header)))
word = 0;
set_fs(fs);
if (word == magic.cmp)
return PAGE_SIZE;
}
#undef FILTER
return 0;
whole:
return vma->vm_end - vma->vm_start;
}
| 4,931 |
38,549 | 0 | __be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr)
{
if (addr->sa_family == AF_IB)
return ((struct sockaddr_ib *) addr)->sib_sid;
return cpu_to_be64(((u64)id->ps << 16) + be16_to_cpu(cma_port(addr)));
}
| 4,932 |
168,037 | 0 | void AutofillManager::FillOrPreviewCreditCardForm(
AutofillDriver::RendererFormDataAction action,
int query_id,
const FormData& form,
const FormFieldData& field,
const CreditCard& credit_card) {
FormStructure* form_structure = nullptr;
AutofillField* autofill_field = nullptr;
if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field))
return;
if (action == AutofillDriver::FORM_DATA_ACTION_FILL) {
if (credit_card.record_type() == CreditCard::MASKED_SERVER_CARD &&
WillFillCreditCardNumber(form, field)) {
unmasking_query_id_ = query_id;
unmasking_form_ = form;
unmasking_field_ = field;
masked_card_ = credit_card;
payments::FullCardRequest* full_card_request =
CreateFullCardRequest(form_structure->form_parsed_timestamp());
full_card_request->GetFullCard(
masked_card_, AutofillClient::UNMASK_FOR_AUTOFILL,
weak_ptr_factory_.GetWeakPtr(), weak_ptr_factory_.GetWeakPtr());
credit_card_form_event_logger_->OnDidSelectMaskedServerCardSuggestion(
form_structure->form_parsed_timestamp());
return;
}
credit_card_form_event_logger_->OnDidFillSuggestion(
credit_card, *form_structure, *autofill_field);
}
FillOrPreviewDataModelForm(
action, query_id, form, field, credit_card, /*is_credit_card=*/true,
/*cvc=*/base::string16(), form_structure, autofill_field);
}
| 4,933 |
62,434 | 0 | pktap_header_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
const pktap_header_t *hdr;
uint32_t dlt, hdrlen;
const char *dltname;
hdr = (const pktap_header_t *)bp;
dlt = EXTRACT_LE_32BITS(&hdr->pkt_dlt);
hdrlen = EXTRACT_LE_32BITS(&hdr->pkt_len);
dltname = pcap_datalink_val_to_name(dlt);
if (!ndo->ndo_qflag) {
ND_PRINT((ndo,"DLT %s (%d) len %d",
(dltname != NULL ? dltname : "UNKNOWN"), dlt, hdrlen));
} else {
ND_PRINT((ndo,"%s", (dltname != NULL ? dltname : "UNKNOWN")));
}
ND_PRINT((ndo, ", length %u: ", length));
}
| 4,934 |
56,758 | 0 | static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
{
dev_dbg(&hub->ports[port1 - 1]->dev, "logical disconnect\n");
hub_port_disable(hub, port1, 1);
/* FIXME let caller ask to power down the port:
* - some devices won't enumerate without a VBUS power cycle
* - SRP saves power that way
* - ... new call, TBD ...
* That's easy if this hub can switch power per-port, and
* hub_wq reactivates the port later (timer, SRP, etc).
* Powerdown must be optional, because of reset/DFU.
*/
set_bit(port1, hub->change_bits);
kick_hub_wq(hub);
}
| 4,935 |
174,002 | 0 | bool Block::IsKey() const {
return ((m_flags & static_cast<unsigned char>(1 << 7)) != 0);
}
| 4,936 |
174,219 | 0 | uint32_t Camera3Device::getDeviceVersion() {
ATRACE_CALL();
Mutex::Autolock il(mInterfaceLock);
return mDeviceVersion;
}
| 4,937 |
184,365 | 1 | ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans,
const Id& id,
const Cryptographer* cryptographer,
StatusController* status) {
MutableEntry entry(trans, syncable::GET_BY_ID, id);
// Must be good as the entry won't have been cleaned up.
CHECK(entry.good());
// This function can only resolve simple conflicts. Simple conflicts have
// both IS_UNSYNCED and IS_UNAPPLIED_UDPATE set.
if (!entry.Get(syncable::IS_UNAPPLIED_UPDATE) ||
!entry.Get(syncable::IS_UNSYNCED)) {
// This is very unusual, but it can happen in tests. We may be able to
// assert NOTREACHED() here when those tests are updated.
return NO_SYNC_PROGRESS;
}
if (entry.Get(syncable::IS_DEL) && entry.Get(syncable::SERVER_IS_DEL)) {
// we've both deleted it, so lets just drop the need to commit/update this
// entry.
entry.Put(syncable::IS_UNSYNCED, false);
entry.Put(syncable::IS_UNAPPLIED_UPDATE, false);
// we've made changes, but they won't help syncing progress.
// METRIC simple conflict resolved by merge.
return NO_SYNC_PROGRESS;
}
// This logic determines "client wins" vs. "server wins" strategy picking.
// By the time we get to this point, we rely on the following to be true:
// a) We can decrypt both the local and server data (else we'd be in
// conflict encryption and not attempting to resolve).
// b) All unsynced changes have been re-encrypted with the default key (
// occurs either in AttemptToUpdateEntry, SetEncryptionPassphrase,
// SetDecryptionPassphrase, or RefreshEncryption).
// c) Base_server_specifics having a valid datatype means that we received
// an undecryptable update that only changed specifics, and since then have
// not received any further non-specifics-only or decryptable updates.
// d) If the server_specifics match specifics, server_specifics are
// encrypted with the default key, and all other visible properties match,
// then we can safely ignore the local changes as redundant.
// e) Otherwise if the base_server_specifics match the server_specifics, no
// functional change must have been made server-side (else
// base_server_specifics would have been cleared), and we can therefore
// safely ignore the server changes as redundant.
// f) Otherwise, it's in general safer to ignore local changes, with the
// exception of deletion conflicts (choose to undelete) and conflicts
// where the non_unique_name or parent don't match.
if (!entry.Get(syncable::SERVER_IS_DEL)) {
// TODO(nick): The current logic is arbitrary; instead, it ought to be made
// consistent with the ModelAssociator behavior for a datatype. It would
// be nice if we could route this back to ModelAssociator code to pick one
// of three options: CLIENT, SERVER, or MERGE. Some datatypes (autofill)
// are easily mergeable.
// See http://crbug.com/77339.
bool name_matches = entry.Get(syncable::NON_UNIQUE_NAME) ==
entry.Get(syncable::SERVER_NON_UNIQUE_NAME);
bool parent_matches = entry.Get(syncable::PARENT_ID) ==
entry.Get(syncable::SERVER_PARENT_ID);
bool entry_deleted = entry.Get(syncable::IS_DEL);
// This positional check is meant to be necessary but not sufficient. As a
// result, it may be false even when the position hasn't changed, possibly
// resulting in unnecessary commits, but if it's true the position has
// definitely not changed. The check works by verifying that the prev id
// as calculated from the server position (which will ignore any
// unsynced/unapplied predecessors and be root for non-bookmark datatypes)
// matches the client prev id. Because we traverse chains of conflicting
// items in predecessor -> successor order, we don't need to also verify the
// successor matches (If it's in conflict, we'll verify it next. If it's
// not, then it should be taken into account already in the
// ComputePrevIdFromServerPosition calculation). This works even when there
// are chains of conflicting items.
//
// Example: Original sequence was abcde. Server changes to aCDbe, while
// client changes to aDCbe (C and D are in conflict). Locally, D's prev id
// is a, while C's prev id is D. On the other hand, the server prev id will
// ignore unsynced/unapplied items, so D's server prev id will also be a,
// just like C's. Because we traverse in client predecessor->successor
// order, we evaluate D first. Since prev id and server id match, we
// consider the position to have remained the same for D, and will unset
// it's UNSYNCED/UNAPPLIED bits. When we evaluate C though, we'll see that
// the prev id is D locally while the server's prev id is a. C will
// therefore count as a positional conflict (and the local data will be
// overwritten by the server data typically). The final result will be
// aCDbe (the same as the server's view). Even though both C and D were
// modified, only one counted as being in actual conflict and was resolved
// with local/server wins.
//
// In general, when there are chains of positional conflicts, only the first
// item in chain (based on the clients point of view) will have both its
// server prev id and local prev id match. For all the rest the server prev
// id will be the predecessor of the first item in the chain, and therefore
// not match the local prev id.
//
// Similarly, chains of conflicts where the server and client info are the
// same are supported due to the predecessor->successor ordering. In this
// case, from the first item onward, we unset the UNSYNCED/UNAPPLIED bits as
// we decide that nothing changed. The subsequent item's server prev id will
// accurately match the local prev id because the predecessor is no longer
// UNSYNCED/UNAPPLIED.
// TODO(zea): simplify all this once we can directly compare server position
// to client position.
syncable::Id server_prev_id = entry.ComputePrevIdFromServerPosition(
entry.Get(syncable::SERVER_PARENT_ID));
bool needs_reinsertion = !parent_matches ||
server_prev_id != entry.Get(syncable::PREV_ID);
DVLOG_IF(1, needs_reinsertion) << "Insertion needed, server prev id "
<< " is " << server_prev_id << ", local prev id is "
<< entry.Get(syncable::PREV_ID);
const sync_pb::EntitySpecifics& specifics =
entry.Get(syncable::SPECIFICS);
const sync_pb::EntitySpecifics& server_specifics =
entry.Get(syncable::SERVER_SPECIFICS);
const sync_pb::EntitySpecifics& base_server_specifics =
entry.Get(syncable::BASE_SERVER_SPECIFICS);
std::string decrypted_specifics, decrypted_server_specifics;
bool specifics_match = false;
bool server_encrypted_with_default_key = false;
if (specifics.has_encrypted()) {
DCHECK(cryptographer->CanDecryptUsingDefaultKey(specifics.encrypted()));
decrypted_specifics = cryptographer->DecryptToString(
specifics.encrypted());
} else {
decrypted_specifics = specifics.SerializeAsString();
}
if (server_specifics.has_encrypted()) {
server_encrypted_with_default_key =
cryptographer->CanDecryptUsingDefaultKey(
server_specifics.encrypted());
decrypted_server_specifics = cryptographer->DecryptToString(
server_specifics.encrypted());
} else {
decrypted_server_specifics = server_specifics.SerializeAsString();
}
if (decrypted_server_specifics == decrypted_specifics &&
server_encrypted_with_default_key == specifics.has_encrypted()) {
specifics_match = true;
}
bool base_server_specifics_match = false;
if (server_specifics.has_encrypted() &&
IsRealDataType(GetModelTypeFromSpecifics(base_server_specifics))) {
std::string decrypted_base_server_specifics;
if (!base_server_specifics.has_encrypted()) {
decrypted_base_server_specifics =
base_server_specifics.SerializeAsString();
} else {
decrypted_base_server_specifics = cryptographer->DecryptToString(
base_server_specifics.encrypted());
}
if (decrypted_server_specifics == decrypted_base_server_specifics)
base_server_specifics_match = true;
}
// We manually merge nigori data.
if (entry.GetModelType() == syncable::NIGORI) {
// Create a new set of specifics based on the server specifics (which
// preserves their encryption keys).
sync_pb::EntitySpecifics specifics =
entry.Get(syncable::SERVER_SPECIFICS);
sync_pb::NigoriSpecifics* server_nigori = specifics.mutable_nigori();
// Store the merged set of encrypted types (cryptographer->Update(..) will
// have merged the local types already).
cryptographer->UpdateNigoriFromEncryptedTypes(server_nigori);
// The cryptographer has the both the local and remote encryption keys
// (added at cryptographer->Update(..) time).
// If the cryptographer is ready, then it already merged both sets of keys
// and we can store them back in. In that case, the remote key was already
// part of the local keybag, so we preserve the local key as the default
// (including whether it's an explicit key).
// If the cryptographer is not ready, then the user will have to provide
// the passphrase to decrypt the pending keys. When they do so, the
// SetDecryptionPassphrase code will act based on whether the server
// update has an explicit passphrase or not.
// - If the server had an explicit passphrase, that explicit passphrase
// will be preserved as the default encryption key.
// - If the server did not have an explicit passphrase, we assume the
// local passphrase is the most up to date and preserve the local
// default encryption key marked as an implicit passphrase.
// This works fine except for the case where we had locally set an
// explicit passphrase. In that case the nigori node will have the default
// key based on the local explicit passphassphrase, but will not have it
// marked as explicit. To fix this we'd have to track whether we have a
// explicit passphrase or not separate from the nigori, which would
// introduce even more complexity, so we leave it up to the user to
// reset that passphrase as an explicit one via settings. The goal here
// is to ensure both sets of encryption keys are preserved.
if (cryptographer->is_ready()) {
cryptographer->GetKeys(server_nigori->mutable_encrypted());
server_nigori->set_using_explicit_passphrase(
entry.Get(syncable::SPECIFICS).nigori().
using_explicit_passphrase());
}
// TODO(zea): Find a better way of doing this. As it stands, we have to
// update this code whenever we add a new non-cryptographer related field
// to the nigori node.
if (entry.Get(syncable::SPECIFICS).nigori().sync_tabs()) {
server_nigori->set_sync_tabs(true);
}
// We deliberately leave the server's device information. This client will
// add its own device information on restart.
entry.Put(syncable::SPECIFICS, specifics);
DVLOG(1) << "Resolving simple conflict, merging nigori nodes: " << entry;
status->increment_num_server_overwrites();
OverwriteServerChanges(trans, &entry);
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
NIGORI_MERGE,
CONFLICT_RESOLUTION_SIZE);
} else if (!entry_deleted && name_matches && parent_matches &&
specifics_match && !needs_reinsertion) {
DVLOG(1) << "Resolving simple conflict, everything matches, ignoring "
<< "changes for: " << entry;
// This unsets both IS_UNSYNCED and IS_UNAPPLIED_UPDATE, and sets the
// BASE_VERSION to match the SERVER_VERSION. If we didn't also unset
// IS_UNAPPLIED_UPDATE, then we would lose unsynced positional data from
// adjacent entries when the server update gets applied and the item is
// re-inserted into the PREV_ID/NEXT_ID linked list. This is primarily
// an issue because we commit after applying updates, and is most
// commonly seen when positional changes are made while a passphrase
// is required (and hence there will be many encryption conflicts).
OverwriteServerChanges(trans, &entry);
IgnoreLocalChanges(&entry);
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
CHANGES_MATCH,
CONFLICT_RESOLUTION_SIZE);
} else if (base_server_specifics_match) {
DVLOG(1) << "Resolving simple conflict, ignoring server encryption "
<< " changes for: " << entry;
status->increment_num_server_overwrites();
OverwriteServerChanges(trans, &entry);
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
IGNORE_ENCRYPTION,
CONFLICT_RESOLUTION_SIZE);
} else if (entry_deleted || !name_matches || !parent_matches) {
OverwriteServerChanges(trans, &entry);
status->increment_num_server_overwrites();
DVLOG(1) << "Resolving simple conflict, overwriting server changes "
<< "for: " << entry;
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
OVERWRITE_SERVER,
CONFLICT_RESOLUTION_SIZE);
} else {
DVLOG(1) << "Resolving simple conflict, ignoring local changes for: "
<< entry;
IgnoreLocalChanges(&entry);
status->increment_num_local_overwrites();
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
OVERWRITE_LOCAL,
CONFLICT_RESOLUTION_SIZE);
}
// Now that we've resolved the conflict, clear the prev server
// specifics.
entry.Put(syncable::BASE_SERVER_SPECIFICS, sync_pb::EntitySpecifics());
return SYNC_PROGRESS;
} else { // SERVER_IS_DEL is true
// If a server deleted folder has local contents it should be a hierarchy
// conflict. Hierarchy conflicts should not be processed by this function.
// We could end up here if a change was made since we last tried to detect
// conflicts, which was during update application.
if (entry.Get(syncable::IS_DIR)) {
Directory::ChildHandles children;
trans->directory()->GetChildHandlesById(trans,
entry.Get(syncable::ID),
&children);
if (0 != children.size()) {
DVLOG(1) << "Entry is a server deleted directory with local contents, "
<< "should be a hierarchy conflict. (race condition).";
return NO_SYNC_PROGRESS;
}
}
// The entry is deleted on the server but still exists locally.
if (!entry.Get(syncable::UNIQUE_CLIENT_TAG).empty()) {
// If we've got a client-unique tag, we can undelete while retaining
// our present ID.
DCHECK_EQ(entry.Get(syncable::SERVER_VERSION), 0) << "For the server to "
"know to re-create, client-tagged items should revert to version 0 "
"when server-deleted.";
OverwriteServerChanges(trans, &entry);
status->increment_num_server_overwrites();
DVLOG(1) << "Resolving simple conflict, undeleting server entry: "
<< entry;
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
OVERWRITE_SERVER,
CONFLICT_RESOLUTION_SIZE);
// Clobber the versions, just in case the above DCHECK is violated.
entry.Put(syncable::SERVER_VERSION, 0);
entry.Put(syncable::BASE_VERSION, 0);
} else {
// Otherwise, we've got to undelete by creating a new locally
// uncommitted entry.
SyncerUtil::SplitServerInformationIntoNewEntry(trans, &entry);
MutableEntry server_update(trans, syncable::GET_BY_ID, id);
CHECK(server_update.good());
CHECK(server_update.Get(syncable::META_HANDLE) !=
entry.Get(syncable::META_HANDLE))
<< server_update << entry;
UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
UNDELETE,
CONFLICT_RESOLUTION_SIZE);
}
return SYNC_PROGRESS;
}
}
| 4,938 |
139,307 | 0 | bool HarfBuzzShaper::fillGlyphBuffer(GlyphBuffer* glyphBuffer)
{
ASSERT(glyphBuffer);
unsigned numRuns = m_harfBuzzRuns.size();
float advanceSoFar = 0;
for (unsigned runIndex = 0; runIndex < numRuns; ++runIndex) {
HarfBuzzRun* currentRun = m_harfBuzzRuns[m_run.ltr() ? runIndex : numRuns - runIndex - 1].get();
if (!currentRun->numGlyphs())
continue;
advanceSoFar += forTextEmphasis()
? fillGlyphBufferForTextEmphasis(glyphBuffer, currentRun, advanceSoFar)
: fillGlyphBufferFromHarfBuzzRun(glyphBuffer, currentRun, advanceSoFar);
}
return glyphBuffer->size();
}
| 4,939 |
121,284 | 0 | void HTMLInputElement::stepUp(int n, ExceptionCode& ec)
{
m_inputType->stepUp(n, ec);
}
| 4,940 |
121,934 | 0 | v8::Handle<v8::Value> V8DOMWindow::eventAttrGetterCustom(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8DOMWindow::GetTemplate(info.GetIsolate(), worldTypeInMainThread(info.GetIsolate())));
if (holder.IsEmpty())
return v8::Undefined();
Frame* frame = V8DOMWindow::toNative(holder)->frame();
if (!BindingSecurity::shouldAllowAccessToFrame(frame))
return v8::Undefined();
ASSERT(frame);
v8::Local<v8::Context> context = frame->script()->currentWorldContext();
if (context.IsEmpty())
return v8::Undefined();
v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol);
if (jsEvent.IsEmpty())
return v8::Undefined();
return jsEvent;
}
| 4,941 |
128,621 | 0 | ~FlagsStateSingleton() {}
| 4,942 |
58,749 | 0 | void tty_del_file(struct file *file)
{
struct tty_file_private *priv = file->private_data;
spin_lock(&tty_files_lock);
list_del(&priv->list);
spin_unlock(&tty_files_lock);
file->private_data = NULL;
kfree(priv);
}
| 4,943 |
65,316 | 0 | bool nfsd4_cache_this_op(struct nfsd4_op *op)
{
if (op->opnum == OP_ILLEGAL)
return false;
return OPDESC(op)->op_flags & OP_CACHEME;
}
| 4,944 |
72,789 | 0 | static int file_read(jas_stream_obj_t *obj, char *buf, int cnt)
{
jas_stream_fileobj_t *fileobj;
JAS_DBGLOG(100, ("file_read(%p, %p, %d)\n", obj, buf, cnt));
fileobj = JAS_CAST(jas_stream_fileobj_t *, obj);
return read(fileobj->fd, buf, cnt);
}
| 4,945 |
181,386 | 1 | static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
{
return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
indx, 0, data, size, 500);
}
| 4,946 |
46,718 | 0 | static int sha256_init(struct shash_desc *desc)
{
struct s390_sha_ctx *sctx = shash_desc_ctx(desc);
sctx->state[0] = SHA256_H0;
sctx->state[1] = SHA256_H1;
sctx->state[2] = SHA256_H2;
sctx->state[3] = SHA256_H3;
sctx->state[4] = SHA256_H4;
sctx->state[5] = SHA256_H5;
sctx->state[6] = SHA256_H6;
sctx->state[7] = SHA256_H7;
sctx->count = 0;
sctx->func = KIMD_SHA_256;
return 0;
}
| 4,947 |
80,152 | 0 | GF_Err gnrm_Size(GF_Box *s)
{
GF_GenericSampleEntryBox *ptr = (GF_GenericSampleEntryBox *)s;
s->type = GF_ISOM_BOX_TYPE_GNRM;
ptr->size += 8+ptr->data_size;
return GF_OK;
}
| 4,948 |
56,208 | 0 | static inline int armv8pmu_enable_intens(int idx)
{
u32 counter;
if (!armv8pmu_counter_valid(idx)) {
pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
smp_processor_id(), idx);
return -EINVAL;
}
counter = ARMV8_IDX_TO_COUNTER(idx);
asm volatile("msr pmintenset_el1, %0" :: "r" (BIT(counter)));
return idx;
}
| 4,949 |
17,764 | 0 | sort_min_max(INT16 *a, INT16 *b)
{
INT16 A, B;
if (*a < 0 || *b < 0)
return;
A = *a;
B = *b;
*a = min(A, B);
*b = max(A, B);
}
| 4,950 |
21,281 | 0 | static unsigned long zap_pte_range(struct mmu_gather *tlb,
struct vm_area_struct *vma, pmd_t *pmd,
unsigned long addr, unsigned long end,
struct zap_details *details)
{
struct mm_struct *mm = tlb->mm;
int force_flush = 0;
int rss[NR_MM_COUNTERS];
spinlock_t *ptl;
pte_t *start_pte;
pte_t *pte;
again:
init_rss_vec(rss);
start_pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
pte = start_pte;
arch_enter_lazy_mmu_mode();
do {
pte_t ptent = *pte;
if (pte_none(ptent)) {
continue;
}
if (pte_present(ptent)) {
struct page *page;
page = vm_normal_page(vma, addr, ptent);
if (unlikely(details) && page) {
/*
* unmap_shared_mapping_pages() wants to
* invalidate cache without truncating:
* unmap shared but keep private pages.
*/
if (details->check_mapping &&
details->check_mapping != page->mapping)
continue;
/*
* Each page->index must be checked when
* invalidating or truncating nonlinear.
*/
if (details->nonlinear_vma &&
(page->index < details->first_index ||
page->index > details->last_index))
continue;
}
ptent = ptep_get_and_clear_full(mm, addr, pte,
tlb->fullmm);
tlb_remove_tlb_entry(tlb, pte, addr);
if (unlikely(!page))
continue;
if (unlikely(details) && details->nonlinear_vma
&& linear_page_index(details->nonlinear_vma,
addr) != page->index)
set_pte_at(mm, addr, pte,
pgoff_to_pte(page->index));
if (PageAnon(page))
rss[MM_ANONPAGES]--;
else {
if (pte_dirty(ptent))
set_page_dirty(page);
if (pte_young(ptent) &&
likely(!VM_SequentialReadHint(vma)))
mark_page_accessed(page);
rss[MM_FILEPAGES]--;
}
page_remove_rmap(page);
if (unlikely(page_mapcount(page) < 0))
print_bad_pte(vma, addr, ptent, page);
force_flush = !__tlb_remove_page(tlb, page);
if (force_flush)
break;
continue;
}
/*
* If details->check_mapping, we leave swap entries;
* if details->nonlinear_vma, we leave file entries.
*/
if (unlikely(details))
continue;
if (pte_file(ptent)) {
if (unlikely(!(vma->vm_flags & VM_NONLINEAR)))
print_bad_pte(vma, addr, ptent, NULL);
} else {
swp_entry_t entry = pte_to_swp_entry(ptent);
if (!non_swap_entry(entry))
rss[MM_SWAPENTS]--;
else if (is_migration_entry(entry)) {
struct page *page;
page = migration_entry_to_page(entry);
if (PageAnon(page))
rss[MM_ANONPAGES]--;
else
rss[MM_FILEPAGES]--;
}
if (unlikely(!free_swap_and_cache(entry)))
print_bad_pte(vma, addr, ptent, NULL);
}
pte_clear_not_present_full(mm, addr, pte, tlb->fullmm);
} while (pte++, addr += PAGE_SIZE, addr != end);
add_mm_rss_vec(mm, rss);
arch_leave_lazy_mmu_mode();
pte_unmap_unlock(start_pte, ptl);
/*
* mmu_gather ran out of room to batch pages, we break out of
* the PTE lock to avoid doing the potential expensive TLB invalidate
* and page-free while holding it.
*/
if (force_flush) {
force_flush = 0;
tlb_flush_mmu(tlb);
if (addr != end)
goto again;
}
return addr;
}
| 4,951 |
55,228 | 0 | static ssize_t ati_remote2_show_channel_mask(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct usb_device *udev = to_usb_device(dev);
struct usb_interface *intf = usb_ifnum_to_if(udev, 0);
struct ati_remote2 *ar2 = usb_get_intfdata(intf);
return sprintf(buf, "0x%04x\n", ar2->channel_mask);
}
| 4,952 |
89,267 | 0 | static void TIFFIgnoreTags(TIFF *tiff)
{
char
*q;
const char
*p,
*tags;
Image
*image;
register ssize_t
i;
size_t
count;
TIFFFieldInfo
*ignore;
if (TIFFGetReadProc(tiff) != TIFFReadBlob)
return;
image=(Image *)TIFFClientdata(tiff);
tags=GetImageArtifact(image,"tiff:ignore-tags");
if (tags == (const char *) NULL)
return;
count=0;
p=tags;
while (*p != '\0')
{
while ((isspace((int) ((unsigned char) *p)) != 0))
p++;
(void) strtol(p,&q,10);
if (p == q)
return;
p=q;
count++;
while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
p++;
}
if (count == 0)
return;
i=0;
p=tags;
ignore=(TIFFFieldInfo *) AcquireQuantumMemory(count,sizeof(*ignore));
if (ignore == (TIFFFieldInfo *) NULL)
return;
/*
This also sets field_bit to 0 (FIELD_IGNORE).
*/
(void) memset(ignore,0,count*sizeof(*ignore));
while (*p != '\0')
{
while ((isspace((int) ((unsigned char) *p)) != 0))
p++;
ignore[i].field_tag=(ttag_t) strtol(p,&q,10);
p=q;
i++;
while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
p++;
}
(void) TIFFMergeFieldInfo(tiff,ignore,(uint32) count);
ignore=(TIFFFieldInfo *) RelinquishMagickMemory(ignore);
}
| 4,953 |
53,088 | 0 | static int check_ld_imm(struct verifier_env *env, struct bpf_insn *insn)
{
struct reg_state *regs = env->cur_state.regs;
int err;
if (BPF_SIZE(insn->code) != BPF_DW) {
verbose("invalid BPF_LD_IMM insn\n");
return -EINVAL;
}
if (insn->off != 0) {
verbose("BPF_LD_IMM64 uses reserved fields\n");
return -EINVAL;
}
err = check_reg_arg(regs, insn->dst_reg, DST_OP);
if (err)
return err;
if (insn->src_reg == 0)
/* generic move 64-bit immediate into a register */
return 0;
/* replace_map_fd_with_map_ptr() should have caught bad ld_imm64 */
BUG_ON(insn->src_reg != BPF_PSEUDO_MAP_FD);
regs[insn->dst_reg].type = CONST_PTR_TO_MAP;
regs[insn->dst_reg].map_ptr = ld_imm64_to_map_ptr(insn);
return 0;
}
| 4,954 |
94,317 | 0 | static void cfq_exit(struct io_context *ioc)
{
rcu_read_lock();
if (!hlist_empty(&ioc->cic_list)) {
struct cfq_io_context *cic;
cic = list_entry(ioc->cic_list.first, struct cfq_io_context,
cic_list);
cic->exit(ioc);
}
rcu_read_unlock();
}
| 4,955 |
164,673 | 0 | virtual ~ConnectionRequest() {}
| 4,956 |
148,766 | 0 | void InterstitialPageImpl::Disable() {
enabled_ = false;
static_cast<InterstitialPageNavigatorImpl*>(frame_tree_->root()->navigator())
->Disable();
}
| 4,957 |
106,179 | 0 | JSValue jsTestObjUnsignedLongSequenceAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsArray(exec, castedThis->globalObject(), impl->unsignedLongSequenceAttr());
return result;
}
| 4,958 |
126,434 | 0 | void BrowserWindowGtk::ShowDevToolsContainer() {
bool to_right = devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT;
gtk_paned_pack2(GTK_PANED(to_right ? contents_hsplit_ : contents_vsplit_),
devtools_container_->widget(),
FALSE,
TRUE);
UpdateDevToolsSplitPosition();
gtk_widget_show(devtools_container_->widget());
}
| 4,959 |
37,504 | 0 | static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
{
WARN_ON(!sp->unsync);
trace_kvm_mmu_sync_page(sp);
sp->unsync = 0;
--kvm->stat.mmu_unsync;
}
| 4,960 |
38,330 | 0 | static inline void bpf_flush_icache(void *start, void *end)
{
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
smp_wmb();
flush_icache_range((unsigned long)start, (unsigned long)end);
set_fs(old_fs);
}
| 4,961 |
163,580 | 0 | htmlCreateFileParserCtxt(const char *filename, const char *encoding)
{
htmlParserCtxtPtr ctxt;
htmlParserInputPtr inputStream;
char *canonicFilename;
/* htmlCharEncoding enc; */
xmlChar *content, *content_line = (xmlChar *) "charset=";
if (filename == NULL)
return(NULL);
ctxt = htmlNewParserCtxt();
if (ctxt == NULL) {
return(NULL);
}
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
if (canonicFilename == NULL) {
#ifdef LIBXML_SAX1_ENABLED
if (xmlDefaultSAXHandler.error != NULL) {
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
}
#endif
xmlFreeParserCtxt(ctxt);
return(NULL);
}
inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt);
xmlFree(canonicFilename);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
}
inputPush(ctxt, inputStream);
/* set encoding */
if (encoding) {
size_t l = strlen(encoding);
if (l < 1000) {
content = xmlMallocAtomic (xmlStrlen(content_line) + l + 1);
if (content) {
strcpy ((char *)content, (char *)content_line);
strcat ((char *)content, (char *)encoding);
htmlCheckEncoding (ctxt, content);
xmlFree (content);
}
}
}
return(ctxt);
}
| 4,962 |
54,814 | 0 | static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep,
struct urb *urb)
{
int count;
if (!ep->ports[0].active)
return;
switch (snd_usb_get_speed(ep->umidi->dev)) {
case USB_SPEED_HIGH:
case USB_SPEED_SUPER:
count = 1;
break;
default:
count = 2;
}
count = snd_rawmidi_transmit(ep->ports[0].substream,
urb->transfer_buffer,
count);
if (count < 1) {
ep->ports[0].active = 0;
return;
}
memset(urb->transfer_buffer + count, 0xFD, ep->max_transfer - count);
urb->transfer_buffer_length = ep->max_transfer;
}
| 4,963 |
65,690 | 0 | static void release_lock_stateid(struct nfs4_ol_stateid *stp)
{
struct nfs4_client *clp = stp->st_stid.sc_client;
bool unhashed;
spin_lock(&clp->cl_lock);
unhashed = unhash_lock_stateid(stp);
spin_unlock(&clp->cl_lock);
if (unhashed)
nfs4_put_stid(&stp->st_stid);
}
| 4,964 |
35,319 | 0 | static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type,
const void *daddr, const void *saddr, unsigned int len)
{
struct ip_tunnel *t = netdev_priv(dev);
struct iphdr *iph = (struct iphdr *)skb_push(skb, t->hlen);
__be16 *p = (__be16*)(iph+1);
memcpy(iph, &t->parms.iph, sizeof(struct iphdr));
p[0] = t->parms.o_flags;
p[1] = htons(type);
/*
* Set the source hardware address.
*/
if (saddr)
memcpy(&iph->saddr, saddr, 4);
if (daddr)
memcpy(&iph->daddr, daddr, 4);
if (iph->daddr)
return t->hlen;
return -t->hlen;
}
| 4,965 |
94,730 | 0 | static int chown_common(struct path *path, uid_t user, gid_t group)
{
struct inode *inode = path->dentry->d_inode;
struct inode *delegated_inode = NULL;
int error;
struct iattr newattrs;
kuid_t uid;
kgid_t gid;
uid = make_kuid(current_user_ns(), user);
gid = make_kgid(current_user_ns(), group);
retry_deleg:
newattrs.ia_valid = ATTR_CTIME;
if (user != (uid_t) -1) {
if (!uid_valid(uid))
return -EINVAL;
newattrs.ia_valid |= ATTR_UID;
newattrs.ia_uid = uid;
}
if (group != (gid_t) -1) {
if (!gid_valid(gid))
return -EINVAL;
newattrs.ia_valid |= ATTR_GID;
newattrs.ia_gid = gid;
}
if (!S_ISDIR(inode->i_mode))
newattrs.ia_valid |=
ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV;
inode_lock(inode);
error = security_path_chown(path, uid, gid);
if (!error)
error = notify_change(path->dentry, &newattrs, &delegated_inode);
inode_unlock(inode);
if (delegated_inode) {
error = break_deleg_wait(&delegated_inode);
if (!error)
goto retry_deleg;
}
return error;
}
| 4,966 |
171,070 | 0 | bool ID3::Iterator::done() const {
return mFrameData == NULL;
}
| 4,967 |
98,925 | 0 | void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken& token, const AtomicString& namespaceURI)
{
ASSERT(token.type() == HTMLToken::StartTag);
notImplemented(); // parseError when xmlns or xmlns:xlink are wrong.
RefPtr<Element> element = attachToCurrent(createElement(token, namespaceURI));
if (!token.selfClosing())
m_openElements.push(element);
}
| 4,968 |
53,145 | 0 | static u16 rtnl_calcit(struct sk_buff *skb, struct nlmsghdr *nlh)
{
struct net *net = sock_net(skb->sk);
struct net_device *dev;
struct nlattr *tb[IFLA_MAX+1];
u32 ext_filter_mask = 0;
u16 min_ifinfo_dump_size = 0;
int hdrlen;
/* Same kernel<->userspace interface hack as in rtnl_dump_ifinfo. */
hdrlen = nlmsg_len(nlh) < sizeof(struct ifinfomsg) ?
sizeof(struct rtgenmsg) : sizeof(struct ifinfomsg);
if (nlmsg_parse(nlh, hdrlen, tb, IFLA_MAX, ifla_policy) >= 0) {
if (tb[IFLA_EXT_MASK])
ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
}
if (!ext_filter_mask)
return NLMSG_GOODSIZE;
/*
* traverse the list of net devices and compute the minimum
* buffer size based upon the filter mask.
*/
list_for_each_entry(dev, &net->dev_base_head, dev_list) {
min_ifinfo_dump_size = max_t(u16, min_ifinfo_dump_size,
if_nlmsg_size(dev,
ext_filter_mask));
}
return min_ifinfo_dump_size;
}
| 4,969 |
1,651 | 0 | clamp_pattern_bbox(gs_pattern1_instance_t * pinst, gs_rect * pbbox,
int width, int height, const gs_matrix * pmat)
{
double xstep = pinst->templat.XStep;
double ystep = pinst->templat.YStep;
double xmin = pbbox->q.x;
double xmax = pbbox->p.x;
double ymin = pbbox->q.y;
double ymax = pbbox->p.y;
int ixpat, iypat, iystart;
double xpat, ypat;
double xlower, xupper, ylower, yupper;
double xdev, ydev;
gs_rect dev_page, pat_page;
gs_point dev_pat_origin, dev_step;
int code;
double xepsilon = FLT_EPSILON * width;
double yepsilon = FLT_EPSILON * height;
/*
* Scan across the page. We determine the region to be scanned
* by working in the pattern coordinate space. This is logically
* simpler since XStep and YStep are on axis in the pattern space.
*/
/* But, since we are starting below bottom left, and 'incrementing' by
* xstep and ystep, make sure they are not negative, or we will be in
* a very long loop indeed.
*/
if (xstep < 0)
xstep *= -1;
if (ystep < 0)
ystep *= -1;
/*
* Convert the page dimensions from device coordinates into the
* pattern coordinate frame.
*/
dev_page.p.x = dev_page.p.y = 0;
dev_page.q.x = width;
dev_page.q.y = height;
code = gs_bbox_transform_inverse(&dev_page, pmat, &pat_page);
if (code < 0)
return code;
/*
* Determine the location of the pattern origin in device coordinates.
*/
gs_point_transform(0.0, 0.0, pmat, &dev_pat_origin);
/*
* Determine our starting point. We start with a postion that puts the
* pattern below and to the left of the page (in pattern space) and scan
* until the pattern is above and right of the page.
*/
ixpat = (int) floor((pat_page.p.x - pinst->templat.BBox.q.x) / xstep);
iystart = (int) floor((pat_page.p.y - pinst->templat.BBox.q.y) / ystep);
/* Now do the scan */
for (; ; ixpat++) {
xpat = ixpat * xstep;
for (iypat = iystart; ; iypat++) {
ypat = iypat * ystep;
/*
* Calculate the shift in the pattern's location.
*/
gs_point_transform(xpat, ypat, pmat, &dev_step);
xdev = dev_step.x - dev_pat_origin.x;
ydev = dev_step.y - dev_pat_origin.y;
/*
* Check if the pattern bounding box intersects the page.
*/
xlower = (xdev + pbbox->p.x > 0) ? pbbox->p.x : -xdev;
xupper = (xdev + pbbox->q.x < width) ? pbbox->q.x : -xdev + width;
ylower = (ydev + pbbox->p.y > 0) ? pbbox->p.y : -ydev;
yupper = (ydev + pbbox->q.y < height) ? pbbox->q.y : -ydev + height;
/* The use of floating point in these calculations causes us
* problems. Values which go through the calculation without ever
* being 'large' retain more accuracy in the lower bits than ones
* which momentarily become large. This is seen in bug 694528
* where a y value of 0.00017... becomes either 0 when 8000 is
* first added to it, then subtracted. This can lead to yupper
* and ylower being different.
*
* The "fix" implemented here is to amend the following test to
* ensure that the region found is larger that 'epsilon'. The
* epsilon values are calculated to reflect the floating point
* innacuracies at the appropriate range.
*/
if (xlower + xepsilon < xupper && ylower + yepsilon < yupper) {
/*
* The pattern intersects the page. Expand required area if
* needed.
*/
if (xlower < xmin)
xmin = xlower;
if (xupper > xmax)
xmax = xupper;
if (ylower < ymin)
ymin = ylower;
if (yupper > ymax)
ymax = yupper;
}
if (ypat > pat_page.q.y - pinst->templat.BBox.p.y)
break;
}
if (xpat > pat_page.q.x - pinst->templat.BBox.p.x)
break;
}
/* Update the bounding box. */
if (xmin < xmax && ymin < ymax) {
pbbox->p.x = xmin;
pbbox->q.x = xmax;
pbbox->p.y = ymin;
pbbox->q.y = ymax;
} else {
/* The pattern is never on the page. Set bbox = 1, 1 */
pbbox->p.x = pbbox->p.y = 0;
pbbox->q.x = pbbox->q.y = 1;
}
return 0;
}
| 4,970 |
149,440 | 0 | ContentSecurityPolicy::DirectiveType ContentSecurityPolicy::getDirectiveType(
const String& name) {
if (name == "base-uri")
return DirectiveType::BaseURI;
if (name == "block-all-mixed-content")
return DirectiveType::BlockAllMixedContent;
if (name == "child-src")
return DirectiveType::ChildSrc;
if (name == "connect-src")
return DirectiveType::ConnectSrc;
if (name == "default-src")
return DirectiveType::DefaultSrc;
if (name == "frame-ancestors")
return DirectiveType::FrameAncestors;
if (name == "frame-src")
return DirectiveType::FrameSrc;
if (name == "font-src")
return DirectiveType::FontSrc;
if (name == "form-action")
return DirectiveType::FormAction;
if (name == "img-src")
return DirectiveType::ImgSrc;
if (name == "manifest-src")
return DirectiveType::ManifestSrc;
if (name == "media-src")
return DirectiveType::MediaSrc;
if (name == "object-src")
return DirectiveType::ObjectSrc;
if (name == "plugin-types")
return DirectiveType::PluginTypes;
if (name == "report-uri")
return DirectiveType::ReportURI;
if (name == "require-sri-for")
return DirectiveType::RequireSRIFor;
if (name == "sandbox")
return DirectiveType::Sandbox;
if (name == "script-src")
return DirectiveType::ScriptSrc;
if (name == "style-src")
return DirectiveType::StyleSrc;
if (name == "treat-as-public-address")
return DirectiveType::TreatAsPublicAddress;
if (name == "upgrade-insecure-requests")
return DirectiveType::UpgradeInsecureRequests;
if (name == "worker-src")
return DirectiveType::WorkerSrc;
return DirectiveType::Undefined;
}
| 4,971 |
15,339 | 0 | static void xmlwriter_free_resource_ptr(xmlwriter_object *intern TSRMLS_DC)
{
if (intern) {
if (intern->ptr) {
xmlFreeTextWriter(intern->ptr);
intern->ptr = NULL;
}
if (intern->output) {
xmlBufferFree(intern->output);
intern->output = NULL;
}
efree(intern);
}
}
| 4,972 |
71,803 | 0 | static int WMFSeekBlob(void *image,long offset)
{
return((int) SeekBlob((Image *) image,(MagickOffsetType) offset,SEEK_SET));
}
| 4,973 |
155,719 | 0 | bool IsUsed(vr::EVRButtonId button_id) {
auto it = used_axes_.find(button_id);
return it != used_axes_.end();
}
| 4,974 |
175,813 | 0 | void ID3::Iterator::findFrame() {
for (;;) {
mFrameData = NULL;
mFrameSize = 0;
if (mParent.mVersion == ID3_V2_2) {
if (mOffset + 6 > mParent.mSize) {
return;
}
if (!memcmp(&mParent.mData[mOffset], "\0\0\0", 3)) {
return;
}
mFrameSize =
(mParent.mData[mOffset + 3] << 16)
| (mParent.mData[mOffset + 4] << 8)
| mParent.mData[mOffset + 5];
if (mFrameSize == 0) {
return;
}
mFrameSize += 6; // add tag id and size field
if (SIZE_MAX - mOffset <= mFrameSize) {
return;
}
if (mOffset + mFrameSize > mParent.mSize) {
ALOGV("partial frame at offset %zu (size = %zu, bytes-remaining = %zu)",
mOffset, mFrameSize, mParent.mSize - mOffset - (size_t)6);
return;
}
mFrameData = &mParent.mData[mOffset + 6];
if (!mID) {
break;
}
char id[4];
memcpy(id, &mParent.mData[mOffset], 3);
id[3] = '\0';
if (!strcmp(id, mID)) {
break;
}
} else if (mParent.mVersion == ID3_V2_3
|| mParent.mVersion == ID3_V2_4) {
if (mOffset + 10 > mParent.mSize) {
return;
}
if (!memcmp(&mParent.mData[mOffset], "\0\0\0\0", 4)) {
return;
}
size_t baseSize = 0;
if (mParent.mVersion == ID3_V2_4) {
if (!ParseSyncsafeInteger(
&mParent.mData[mOffset + 4], &baseSize)) {
return;
}
} else {
baseSize = U32_AT(&mParent.mData[mOffset + 4]);
}
if (baseSize == 0) {
return;
}
if (SIZE_MAX - 10 <= baseSize) {
return;
}
mFrameSize = 10 + baseSize; // add tag id, size field and flags
if (SIZE_MAX - mOffset <= mFrameSize) {
return;
}
if (mOffset + mFrameSize > mParent.mSize) {
ALOGV("partial frame at offset %zu (size = %zu, bytes-remaining = %zu)",
mOffset, mFrameSize, mParent.mSize - mOffset - (size_t)10);
return;
}
uint16_t flags = U16_AT(&mParent.mData[mOffset + 8]);
if ((mParent.mVersion == ID3_V2_4 && (flags & 0x000c))
|| (mParent.mVersion == ID3_V2_3 && (flags & 0x00c0))) {
ALOGV("Skipping unsupported frame (compression, encryption "
"or per-frame unsynchronization flagged");
mOffset += mFrameSize;
continue;
}
mFrameData = &mParent.mData[mOffset + 10];
if (!mID) {
break;
}
char id[5];
memcpy(id, &mParent.mData[mOffset], 4);
id[4] = '\0';
if (!strcmp(id, mID)) {
break;
}
} else {
CHECK(mParent.mVersion == ID3_V1 || mParent.mVersion == ID3_V1_1);
if (mOffset >= mParent.mSize) {
return;
}
mFrameData = &mParent.mData[mOffset];
switch (mOffset) {
case 3:
case 33:
case 63:
mFrameSize = 30;
break;
case 93:
mFrameSize = 4;
break;
case 97:
if (mParent.mVersion == ID3_V1) {
mFrameSize = 30;
} else {
mFrameSize = 29;
}
break;
case 126:
mFrameSize = 1;
break;
case 127:
mFrameSize = 1;
break;
default:
CHECK(!"Should not be here, invalid offset.");
break;
}
if (!mID) {
break;
}
String8 id;
getID(&id);
if (id == mID) {
break;
}
}
mOffset += mFrameSize;
}
}
| 4,975 |
144,506 | 0 | WebContentsImpl* WebContentsImpl::FromFrameTreeNode(
FrameTreeNode* frame_tree_node) {
return static_cast<WebContentsImpl*>(
WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host()));
}
| 4,976 |
156,286 | 0 | const char* RendererSchedulerImpl::VirtualTimePolicyToString(
VirtualTimePolicy virtual_time_policy) {
switch (virtual_time_policy) {
case VirtualTimePolicy::kAdvance:
return "ADVANCE";
case VirtualTimePolicy::kPause:
return "PAUSE";
case VirtualTimePolicy::kDeterministicLoading:
return "DETERMINISTIC_LOADING";
default:
NOTREACHED();
return nullptr;
}
}
| 4,977 |
58,084 | 0 | static int snd_compr_open(struct inode *inode, struct file *f)
{
struct snd_compr *compr;
struct snd_compr_file *data;
struct snd_compr_runtime *runtime;
enum snd_compr_direction dirn;
int maj = imajor(inode);
int ret;
if ((f->f_flags & O_ACCMODE) == O_WRONLY)
dirn = SND_COMPRESS_PLAYBACK;
else if ((f->f_flags & O_ACCMODE) == O_RDONLY)
dirn = SND_COMPRESS_CAPTURE;
else
return -EINVAL;
if (maj == snd_major)
compr = snd_lookup_minor_data(iminor(inode),
SNDRV_DEVICE_TYPE_COMPRESS);
else
return -EBADFD;
if (compr == NULL) {
pr_err("no device data!!!\n");
return -ENODEV;
}
if (dirn != compr->direction) {
pr_err("this device doesn't support this direction\n");
snd_card_unref(compr->card);
return -EINVAL;
}
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) {
snd_card_unref(compr->card);
return -ENOMEM;
}
data->stream.ops = compr->ops;
data->stream.direction = dirn;
data->stream.private_data = compr->private_data;
data->stream.device = compr;
runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
if (!runtime) {
kfree(data);
snd_card_unref(compr->card);
return -ENOMEM;
}
runtime->state = SNDRV_PCM_STATE_OPEN;
init_waitqueue_head(&runtime->sleep);
data->stream.runtime = runtime;
f->private_data = (void *)data;
mutex_lock(&compr->lock);
ret = compr->ops->open(&data->stream);
mutex_unlock(&compr->lock);
if (ret) {
kfree(runtime);
kfree(data);
}
snd_card_unref(compr->card);
return ret;
}
| 4,978 |
20,694 | 0 | static void fx_free(struct kvm_vcpu *vcpu)
{
fpu_free(&vcpu->arch.guest_fpu);
}
| 4,979 |
180,764 | 1 | cmsPipeline* DefaultICCintents(cmsContext ContextID,
cmsUInt32Number nProfiles,
cmsUInt32Number TheIntents[],
cmsHPROFILE hProfiles[],
cmsBool BPC[],
cmsFloat64Number AdaptationStates[],
cmsUInt32Number dwFlags)
{
cmsPipeline* Lut = NULL;
cmsPipeline* Result;
cmsHPROFILE hProfile;
cmsMAT3 m;
cmsVEC3 off;
cmsColorSpaceSignature ColorSpaceIn, ColorSpaceOut, CurrentColorSpace;
cmsProfileClassSignature ClassSig;
cmsUInt32Number i, Intent;
// For safety
if (nProfiles == 0) return NULL;
// Allocate an empty LUT for holding the result. 0 as channel count means 'undefined'
Result = cmsPipelineAlloc(ContextID, 0, 0);
if (Result == NULL) return NULL;
CurrentColorSpace = cmsGetColorSpace(hProfiles[0]);
for (i=0; i < nProfiles; i++) {
cmsBool lIsDeviceLink, lIsInput;
hProfile = hProfiles[i];
ClassSig = cmsGetDeviceClass(hProfile);
lIsDeviceLink = (ClassSig == cmsSigLinkClass || ClassSig == cmsSigAbstractClass );
// First profile is used as input unless devicelink or abstract
if ((i == 0) && !lIsDeviceLink) {
lIsInput = TRUE;
}
else {
// Else use profile in the input direction if current space is not PCS
lIsInput = (CurrentColorSpace != cmsSigXYZData) &&
(CurrentColorSpace != cmsSigLabData);
}
Intent = TheIntents[i];
if (lIsInput || lIsDeviceLink) {
ColorSpaceIn = cmsGetColorSpace(hProfile);
ColorSpaceOut = cmsGetPCS(hProfile);
}
else {
ColorSpaceIn = cmsGetPCS(hProfile);
ColorSpaceOut = cmsGetColorSpace(hProfile);
}
if (!ColorSpaceIsCompatible(ColorSpaceIn, CurrentColorSpace)) {
cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "ColorSpace mismatch");
goto Error;
}
// If devicelink is found, then no custom intent is allowed and we can
// read the LUT to be applied. Settings don't apply here.
if (lIsDeviceLink || ((ClassSig == cmsSigNamedColorClass) && (nProfiles == 1))) {
// Get the involved LUT from the profile
Lut = _cmsReadDevicelinkLUT(hProfile, Intent);
if (Lut == NULL) goto Error;
// What about abstract profiles?
if (ClassSig == cmsSigAbstractClass && i > 0) {
if (!ComputeConversion(i, hProfiles, Intent, BPC[i], AdaptationStates[i], &m, &off)) goto Error;
}
else {
_cmsMAT3identity(&m);
_cmsVEC3init(&off, 0, 0, 0);
}
if (!AddConversion(Result, CurrentColorSpace, ColorSpaceIn, &m, &off)) goto Error;
}
else {
if (lIsInput) {
// Input direction means non-pcs connection, so proceed like devicelinks
Lut = _cmsReadInputLUT(hProfile, Intent);
if (Lut == NULL) goto Error;
}
else {
// Output direction means PCS connection. Intent may apply here
Lut = _cmsReadOutputLUT(hProfile, Intent);
if (Lut == NULL) goto Error;
if (!ComputeConversion(i, hProfiles, Intent, BPC[i], AdaptationStates[i], &m, &off)) goto Error;
if (!AddConversion(Result, CurrentColorSpace, ColorSpaceIn, &m, &off)) goto Error;
}
}
// Concatenate to the output LUT
if (!cmsPipelineCat(Result, Lut))
goto Error;
cmsPipelineFree(Lut);
// Update current space
CurrentColorSpace = ColorSpaceOut;
}
return Result;
Error:
cmsPipelineFree(Lut);
if (Result != NULL) cmsPipelineFree(Result);
return NULL;
cmsUNUSED_PARAMETER(dwFlags);
}
| 4,980 |
18,065 | 0 | jbig2_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
{
uint32_t page_number = ctx->pages[ctx->current_page].number;
if (segment->page_association != page_number) {
jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
"end of page marker for page %d doesn't match current page number %d", segment->page_association, page_number);
}
jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of page %d", page_number);
jbig2_complete_page(ctx);
#ifdef OUTPUT_PBM
jbig2_image_write_pbm(ctx->pages[ctx->current_page].image, stdout);
#endif
return 0;
}
| 4,981 |
125,157 | 0 | void Fail() {
if (!expect_fail_)
FAIL();
QuitMessageLoop();
}
| 4,982 |
6,053 | 0 | e1000e_set_dbal(E1000ECore *core, int index, uint32_t val)
{
core->mac[index] = val & E1000_XDBAL_MASK;
}
| 4,983 |
844 | 0 | ArthurOutputDev::ArthurOutputDev(QPainter *painter):
m_painter(painter)
{
m_currentBrush = QBrush(Qt::SolidPattern);
m_fontEngine = 0;
m_font = 0;
m_image = 0;
}
| 4,984 |
122,699 | 0 | bool Extension::LoadSharedFeatures(
const APIPermissionSet& api_permissions,
string16* error) {
if (!LoadDescription(error) ||
!LoadIcons(error) ||
!ManifestHandler::ParseExtension(this, error) ||
!LoadPlugins(error) ||
!LoadNaClModules(error) ||
!LoadSandboxedPages(error) ||
!LoadRequirements(error) ||
!LoadOfflineEnabled(error) ||
!LoadBackgroundScripts(error) ||
!LoadBackgroundPage(api_permissions, error) ||
!LoadBackgroundPersistent(api_permissions, error) ||
!LoadBackgroundAllowJSAccess(api_permissions, error))
return false;
return true;
}
| 4,985 |
97,254 | 0 | void appendCharactersCallback(const xmlChar* s, int len)
{
PendingCharactersCallback* callback = new PendingCharactersCallback;
callback->s = xmlStrndup(s, len);
callback->len = len;
m_callbacks.append(callback);
}
| 4,986 |
39,325 | 0 | static ssize_t show_model(struct device *cd,
struct device_attribute *attr, char *buf)
{
struct media_device *mdev = to_media_device(to_media_devnode(cd));
return sprintf(buf, "%.*s\n", (int)sizeof(mdev->model), mdev->model);
}
| 4,987 |
5,219 | 0 | static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
{
return *buf = _php_pgsql_trim_message(PQerrorMessage(pgsql), NULL);
}
| 4,988 |
173,013 | 0 | display_cache_file(struct display *dp, const char *filename)
/* Does the initial cache of the file. */
{
FILE *fp;
int ret;
dp->filename = filename;
if (filename != NULL)
{
fp = fopen(filename, "rb");
if (fp == NULL)
display_log(dp, USER_ERROR, "open failed: %s", strerror(errno));
}
else
fp = stdin;
ret = buffer_from_file(&dp->original_file, fp);
fclose(fp);
if (ret != 0)
display_log(dp, APP_ERROR, "read failed: %s", strerror(ret));
}
| 4,989 |
112,687 | 0 | void DocumentLoader::removeSubresourceLoader(ResourceLoader* loader)
{
if (!m_subresourceLoaders.contains(loader))
return;
m_subresourceLoaders.remove(loader);
checkLoadComplete();
if (Frame* frame = m_frame)
frame->loader()->checkLoadComplete();
}
| 4,990 |
105,040 | 0 | int TestURLFetcher::response_code() const {
return fake_response_code_;
}
| 4,991 |
113,057 | 0 | std::string DownloadItemImpl::GetSuggestedFilename() const {
return suggested_filename_;
}
| 4,992 |
7,525 | 0 | tt_synth_sfnt_checksum( FT_Stream stream,
FT_ULong length )
{
FT_Error error;
FT_UInt32 checksum = 0;
FT_UInt i;
if ( FT_FRAME_ENTER( length ) )
return 0;
for ( ; length > 3; length -= 4 )
checksum += (FT_UInt32)FT_GET_ULONG();
for ( i = 3; length > 0; length--, i-- )
checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
FT_FRAME_EXIT();
return checksum;
}
| 4,993 |
103,657 | 0 | unsigned long long ChromeContentRendererClient::VisitedLinkHash(
const char* canonical_url, size_t length) {
return visited_link_slave_->ComputeURLFingerprint(canonical_url, length);
}
| 4,994 |
1,863 | 0 | int reds_get_agent_mouse(void)
{
return agent_mouse;
}
| 4,995 |
45,029 | 0 | static int em_mov_rm_sreg(struct x86_emulate_ctxt *ctxt)
{
if (ctxt->modrm_reg > VCPU_SREG_GS)
return emulate_ud(ctxt);
ctxt->dst.val = get_segment_selector(ctxt, ctxt->modrm_reg);
if (ctxt->dst.bytes == 4 && ctxt->dst.type == OP_MEM)
ctxt->dst.bytes = 2;
return X86EMUL_CONTINUE;
}
| 4,996 |
62,188 | 0 | static void CALLBACK FormatPromptHook(HWINEVENTHOOK hWinEventHook, DWORD Event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)
{
char str[128];
BOOL found;
if (Event == EVENT_SYSTEM_FOREGROUND) {
if (GetWindowLong(hWnd, GWL_STYLE) & WS_POPUPWINDOW) {
str[0] = 0;
GetWindowTextU(hWnd, str, sizeof(str));
if (safe_strcmp(str, fp_title_str) == 0) {
found = FALSE;
EnumChildWindows(hWnd, FormatPromptCallback, (LPARAM)&found);
if (found) {
SendMessage(hWnd, WM_COMMAND, (WPARAM)IDCANCEL, (LPARAM)0);
uprintf("Closed Windows format prompt");
}
}
}
}
}
| 4,997 |
48,624 | 0 | static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev,
unsigned index, unsigned start,
unsigned count, uint32_t flags, void *data)
{
if (!is_intx(vdev) || start != 0 || count != 1)
return -EINVAL;
if (flags & VFIO_IRQ_SET_DATA_NONE) {
vfio_pci_intx_unmask(vdev);
} else if (flags & VFIO_IRQ_SET_DATA_BOOL) {
uint8_t unmask = *(uint8_t *)data;
if (unmask)
vfio_pci_intx_unmask(vdev);
} else if (flags & VFIO_IRQ_SET_DATA_EVENTFD) {
int32_t fd = *(int32_t *)data;
if (fd >= 0)
return vfio_virqfd_enable((void *) vdev,
vfio_pci_intx_unmask_handler,
vfio_send_intx_eventfd, NULL,
&vdev->ctx[0].unmask, fd);
vfio_virqfd_disable(&vdev->ctx[0].unmask);
}
return 0;
}
| 4,998 |
104,579 | 0 | explicit TimedLimitMockFunction(const std::string& name)
: MockFunction(name) {}
| 4,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.