unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
154,800 | 0 | error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathInstancedCHROMIUM(
GLsizei numPaths,
GLenum pathNameType,
const GLvoid* paths,
GLsizei pathsBufsize,
GLuint pathBase,
GLenum fillMode,
GLuint mask,
GLenum transformType,
const GLfloat* transformValues,
GLsizei transformValuesBufsize) {
NOTIMPLEMENTED();
return error::kNoError;
}
| 2,100 |
58,662 | 0 | BOOL security_key_update(BYTE* key, BYTE* update_key, int key_len)
{
BYTE sha1h[CRYPTO_SHA1_DIGEST_LENGTH];
CryptoMd5 md5;
CryptoSha1 sha1;
CryptoRc4 rc4;
BYTE salt40[] = { 0xD1, 0x26, 0x9E };
sha1 = crypto_sha1_init();
crypto_sha1_update(sha1, update_key, key_len);
crypto_sha1_update(sha1, pad1, sizeof(pad1));
crypto_sha1_update(sha1, key, key_len);
crypto_sha1_final(sha1, sha1h);
md5 = crypto_md5_init();
crypto_md5_update(md5, update_key, key_len);
crypto_md5_update(md5, pad2, sizeof(pad2));
crypto_md5_update(md5, sha1h, sizeof(sha1h));
crypto_md5_final(md5, key);
rc4 = crypto_rc4_init(key, key_len);
crypto_rc4(rc4, key_len, key, key);
crypto_rc4_free(rc4);
if (key_len == 8)
memcpy(key, salt40, 3); /* TODO 56 bit */
return TRUE;
}
| 2,101 |
50,560 | 0 | static inline void ModulateHSI(const double percent_hue,
const double percent_saturation,const double percent_intensity,double *red,
double *green,double *blue)
{
double
intensity,
hue,
saturation;
/*
Increase or decrease color intensity, saturation, or hue.
*/
ConvertRGBToHSI(*red,*green,*blue,&hue,&saturation,&intensity);
hue+=0.5*(0.01*percent_hue-1.0);
while (hue < 0.0)
hue+=1.0;
while (hue > 1.0)
hue-=1.0;
saturation*=0.01*percent_saturation;
intensity*=0.01*percent_intensity;
ConvertHSIToRGB(hue,saturation,intensity,red,green,blue);
}
| 2,102 |
4,723 | 0 | user_change_shell_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *shell = data;
g_autoptr(GError) error = NULL;
const gchar *argv[6];
if (g_strcmp0 (accounts_user_get_shell (ACCOUNTS_USER (user)), shell) != 0) {
sys_log (context,
"change shell of user '%s' (%d) to '%s'",
accounts_user_get_user_name (ACCOUNTS_USER (user)),
accounts_user_get_uid (ACCOUNTS_USER (user)),
shell);
argv[0] = "/usr/sbin/usermod";
argv[1] = "-s";
argv[2] = shell;
argv[3] = "--";
argv[4] = accounts_user_get_user_name (ACCOUNTS_USER (user));
argv[5] = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
return;
}
accounts_user_set_shell (ACCOUNTS_USER (user), shell);
}
accounts_user_complete_set_shell (ACCOUNTS_USER (user), context);
}
| 2,103 |
32,238 | 0 | int unregister_netdevice_notifier(struct notifier_block *nb)
{
int err;
rtnl_lock();
err = raw_notifier_chain_unregister(&netdev_chain, nb);
rtnl_unlock();
return err;
}
| 2,104 |
107,547 | 0 | void ewk_view_load_document_finished(Evas_Object* ewkView, Evas_Object* frame)
{
evas_object_smart_callback_call(ewkView, "load,document,finished", frame);
}
| 2,105 |
111,322 | 0 | IntPoint WebPagePrivate::scrollPosition() const
{
return m_backingStoreClient->scrollPosition();
}
| 2,106 |
77,074 | 0 | parse_SET_L4_SRC_PORT(char *arg, struct ofpbuf *ofpacts,
enum ofputil_protocol *usable_protocols OVS_UNUSED)
{
return str_to_u16(arg, "source port",
&ofpact_put_SET_L4_SRC_PORT(ofpacts)->port);
}
| 2,107 |
37,604 | 0 | static void walk_shadow_page_lockless_begin(struct kvm_vcpu *vcpu)
{
/*
* Prevent page table teardown by making any free-er wait during
* kvm_flush_remote_tlbs() IPI to all active vcpus.
*/
local_irq_disable();
vcpu->mode = READING_SHADOW_PAGE_TABLES;
/*
* Make sure a following spte read is not reordered ahead of the write
* to vcpu->mode.
*/
smp_mb();
}
| 2,108 |
88,396 | 0 | static uint8_t spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics, bitfile *ld,
int16_t *spectral_data)
{
int8_t i;
uint8_t g;
uint16_t inc, k, p = 0;
uint8_t groups = 0;
uint8_t sect_cb;
uint8_t result;
uint16_t nshort = hDecoder->frameLength/8;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
for(g = 0; g < ics->num_window_groups; g++)
{
p = groups*nshort;
for (i = 0; i < ics->num_sec[g]; i++)
{
sect_cb = ics->sect_cb[g][i];
inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4;
switch (sect_cb)
{
case ZERO_HCB:
case NOISE_HCB:
case INTENSITY_HCB:
case INTENSITY_HCB2:
#ifdef SD_PRINT
{
int j;
for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
{
printf("%d\n", 0);
}
}
#endif
#ifdef SFBO_PRINT
printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
#endif
p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
break;
default:
#ifdef SFBO_PRINT
printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
#endif
for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
{
if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
return result;
#ifdef SD_PRINT
{
int j;
for (j = p; j < p+inc; j++)
{
printf("%d\n", spectral_data[j]);
}
}
#endif
p += inc;
}
break;
}
}
groups += ics->window_group_length[g];
}
#ifdef PROFILE
count = faad_get_ts() - count;
hDecoder->spectral_cycles += count;
#endif
return 0;
}
| 2,109 |
155,347 | 0 | void ChromeContentBrowserClient::GetHardwareSecureDecryptionCaps(
const std::string& key_system,
const base::flat_set<media::CdmProxy::Protocol>& cdm_proxy_protocols,
base::flat_set<media::VideoCodec>* video_codecs,
base::flat_set<media::EncryptionMode>* encryption_schemes) {
#if defined(OS_WIN) && BUILDFLAG(ENABLE_LIBRARY_CDMS) && \
BUILDFLAG(ENABLE_WIDEVINE)
if (key_system == kWidevineKeySystem) {
GetWidevineHardwareCaps(cdm_proxy_protocols, video_codecs,
encryption_schemes);
}
#endif
}
| 2,110 |
9,185 | 0 | void virtio_config_modern_writel(VirtIODevice *vdev,
uint32_t addr, uint32_t data)
{
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
uint32_t val = data;
if (addr + sizeof(val) > vdev->config_len) {
return;
}
stl_le_p(vdev->config + addr, val);
if (k->set_config) {
k->set_config(vdev, vdev->config);
}
}
| 2,111 |
19,681 | 0 | static ssize_t free_hugepages_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
struct hstate *h;
unsigned long free_huge_pages;
int nid;
h = kobj_to_hstate(kobj, &nid);
if (nid == NUMA_NO_NODE)
free_huge_pages = h->free_huge_pages;
else
free_huge_pages = h->free_huge_pages_node[nid];
return sprintf(buf, "%lu\n", free_huge_pages);
}
| 2,112 |
61,227 | 0 | static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MaxTextExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
magick[2*MaxTextExtent];
if ((clone_info=CloneImageInfo(image_info)) == NULL)
return(image);
clone_info->blob=(void *) NULL;
clone_info->length=0;
/* Obtain temporary file */
(void) AcquireUniqueFilename(postscript_file);
ps_file=fopen_utf8(postscript_file,"wb");
if (ps_file == (FILE *) NULL)
goto FINISH;
/* Copy postscript to temporary file */
(void) SeekBlob(image,PS_Offset,SEEK_SET);
(void) ReadBlob(image, 2*MaxTextExtent, magick);
(void) SeekBlob(image,PS_Offset,SEEK_SET);
while(PS_Size-- > 0)
{
(void) fputc(ReadBlobByte(image),ps_file);
}
(void) fclose(ps_file);
/* Detect file format - Check magic.mgk configuration file. */
magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);
if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;
/* printf("Detected:%s \n",magic_info->name); */
if(exception->severity != UndefinedException) goto FINISH_UNL;
if(magic_info->name == (char *) NULL) goto FINISH_UNL;
(void) strncpy(clone_info->magick,magic_info->name,MaxTextExtent-1);
/* Read nested image */
/*FormatString(clone_info->filename,"%s:%s",magic_info->name,postscript_file);*/
FormatLocaleString(clone_info->filename,MaxTextExtent,"%s",postscript_file);
image2=ReadImage(clone_info,exception);
if (!image2)
goto FINISH_UNL;
/*
Replace current image with new image while copying base image
attributes.
*/
(void) CopyMagickString(image2->filename,image->filename,MaxTextExtent);
(void) CopyMagickString(image2->magick_filename,image->magick_filename,MaxTextExtent);
(void) CopyMagickString(image2->magick,image->magick,MaxTextExtent);
image2->depth=image->depth;
DestroyBlob(image2);
image2->blob=ReferenceBlob(image->blob);
if ((image->rows == 0) || (image->columns == 0))
DeleteImageFromList(&image);
AppendImageToList(&image,image2);
FINISH_UNL:
(void) RelinquishUniqueFileResource(postscript_file);
FINISH:
DestroyImageInfo(clone_info);
return(image);
}
| 2,113 |
46,594 | 0 | static inline void writeit(int f, void *buf, size_t len) {
ssize_t res;
while (len > 0) {
DEBUG("+");
if ((res = write(f, buf, len)) <= 0)
err("Send failed: %m");
len -= res;
buf += res;
}
}
| 2,114 |
143,110 | 0 | DEFINE_TRACE(Document)
{
visitor->trace(m_importsController);
visitor->trace(m_docType);
visitor->trace(m_implementation);
visitor->trace(m_autofocusElement);
visitor->trace(m_focusedElement);
visitor->trace(m_sequentialFocusNavigationStartingPoint);
visitor->trace(m_hoverNode);
visitor->trace(m_activeHoverElement);
visitor->trace(m_documentElement);
visitor->trace(m_rootScrollerController);
visitor->trace(m_titleElement);
visitor->trace(m_axObjectCache);
visitor->trace(m_markers);
visitor->trace(m_cssTarget);
visitor->trace(m_currentScriptStack);
visitor->trace(m_scriptRunner);
visitor->trace(m_listsInvalidatedAtDocument);
for (int i = 0; i < numNodeListInvalidationTypes; ++i)
visitor->trace(m_nodeLists[i]);
visitor->trace(m_topLayerElements);
visitor->trace(m_elemSheet);
visitor->trace(m_nodeIterators);
visitor->trace(m_ranges);
visitor->trace(m_styleEngine);
visitor->trace(m_formController);
visitor->trace(m_visitedLinkState);
visitor->trace(m_frame);
visitor->trace(m_domWindow);
visitor->trace(m_fetcher);
visitor->trace(m_parser);
visitor->trace(m_contextFeatures);
visitor->trace(m_styleSheetList);
visitor->trace(m_documentTiming);
visitor->trace(m_mediaQueryMatcher);
visitor->trace(m_scriptedAnimationController);
visitor->trace(m_scriptedIdleTaskController);
visitor->trace(m_textAutosizer);
visitor->trace(m_registrationContext);
visitor->trace(m_customElementMicrotaskRunQueue);
visitor->trace(m_elementDataCache);
visitor->trace(m_associatedFormControls);
visitor->trace(m_useElementsNeedingUpdate);
visitor->trace(m_layerUpdateSVGFilterElements);
visitor->trace(m_timers);
visitor->trace(m_templateDocument);
visitor->trace(m_templateDocumentHost);
visitor->trace(m_userActionElements);
visitor->trace(m_svgExtensions);
visitor->trace(m_timeline);
visitor->trace(m_compositorPendingAnimations);
visitor->trace(m_contextDocument);
visitor->trace(m_canvasFontCache);
visitor->trace(m_intersectionObserverController);
visitor->trace(m_intersectionObserverData);
visitor->trace(m_snapCoordinator);
Supplementable<Document>::trace(visitor);
TreeScope::trace(visitor);
ContainerNode::trace(visitor);
ExecutionContext::trace(visitor);
SecurityContext::trace(visitor);
}
| 2,115 |
52,938 | 0 | static int qib_get_base_info(struct file *fp, void __user *ubase,
size_t ubase_size)
{
struct qib_ctxtdata *rcd = ctxt_fp(fp);
int ret = 0;
struct qib_base_info *kinfo = NULL;
struct qib_devdata *dd = rcd->dd;
struct qib_pportdata *ppd = rcd->ppd;
unsigned subctxt_cnt;
int shared, master;
size_t sz;
subctxt_cnt = rcd->subctxt_cnt;
if (!subctxt_cnt) {
shared = 0;
master = 0;
subctxt_cnt = 1;
} else {
shared = 1;
master = !subctxt_fp(fp);
}
sz = sizeof(*kinfo);
/* If context sharing is not requested, allow the old size structure */
if (!shared)
sz -= 7 * sizeof(u64);
if (ubase_size < sz) {
ret = -EINVAL;
goto bail;
}
kinfo = kzalloc(sizeof(*kinfo), GFP_KERNEL);
if (kinfo == NULL) {
ret = -ENOMEM;
goto bail;
}
ret = dd->f_get_base_info(rcd, kinfo);
if (ret < 0)
goto bail;
kinfo->spi_rcvhdr_cnt = dd->rcvhdrcnt;
kinfo->spi_rcvhdrent_size = dd->rcvhdrentsize;
kinfo->spi_tidegrcnt = rcd->rcvegrcnt;
kinfo->spi_rcv_egrbufsize = dd->rcvegrbufsize;
/*
* have to mmap whole thing
*/
kinfo->spi_rcv_egrbuftotlen =
rcd->rcvegrbuf_chunks * rcd->rcvegrbuf_size;
kinfo->spi_rcv_egrperchunk = rcd->rcvegrbufs_perchunk;
kinfo->spi_rcv_egrchunksize = kinfo->spi_rcv_egrbuftotlen /
rcd->rcvegrbuf_chunks;
kinfo->spi_tidcnt = dd->rcvtidcnt / subctxt_cnt;
if (master)
kinfo->spi_tidcnt += dd->rcvtidcnt % subctxt_cnt;
/*
* for this use, may be cfgctxts summed over all chips that
* are are configured and present
*/
kinfo->spi_nctxts = dd->cfgctxts;
/* unit (chip/board) our context is on */
kinfo->spi_unit = dd->unit;
kinfo->spi_port = ppd->port;
/* for now, only a single page */
kinfo->spi_tid_maxsize = PAGE_SIZE;
/*
* Doing this per context, and based on the skip value, etc. This has
* to be the actual buffer size, since the protocol code treats it
* as an array.
*
* These have to be set to user addresses in the user code via mmap.
* These values are used on return to user code for the mmap target
* addresses only. For 32 bit, same 44 bit address problem, so use
* the physical address, not virtual. Before 2.6.11, using the
* page_address() macro worked, but in 2.6.11, even that returns the
* full 64 bit address (upper bits all 1's). So far, using the
* physical addresses (or chip offsets, for chip mapping) works, but
* no doubt some future kernel release will change that, and we'll be
* on to yet another method of dealing with this.
* Normally only one of rcvhdr_tailaddr or rhf_offset is useful
* since the chips with non-zero rhf_offset don't normally
* enable tail register updates to host memory, but for testing,
* both can be enabled and used.
*/
kinfo->spi_rcvhdr_base = (u64) rcd->rcvhdrq_phys;
kinfo->spi_rcvhdr_tailaddr = (u64) rcd->rcvhdrqtailaddr_phys;
kinfo->spi_rhf_offset = dd->rhf_offset;
kinfo->spi_rcv_egrbufs = (u64) rcd->rcvegr_phys;
kinfo->spi_pioavailaddr = (u64) dd->pioavailregs_phys;
/* setup per-unit (not port) status area for user programs */
kinfo->spi_status = (u64) kinfo->spi_pioavailaddr +
(char *) ppd->statusp -
(char *) dd->pioavailregs_dma;
kinfo->spi_uregbase = (u64) dd->uregbase + dd->ureg_align * rcd->ctxt;
if (!shared) {
kinfo->spi_piocnt = rcd->piocnt;
kinfo->spi_piobufbase = (u64) rcd->piobufs;
kinfo->spi_sendbuf_status = cvt_kvaddr(rcd->user_event_mask);
} else if (master) {
kinfo->spi_piocnt = (rcd->piocnt / subctxt_cnt) +
(rcd->piocnt % subctxt_cnt);
/* Master's PIO buffers are after all the slave's */
kinfo->spi_piobufbase = (u64) rcd->piobufs +
dd->palign *
(rcd->piocnt - kinfo->spi_piocnt);
} else {
unsigned slave = subctxt_fp(fp) - 1;
kinfo->spi_piocnt = rcd->piocnt / subctxt_cnt;
kinfo->spi_piobufbase = (u64) rcd->piobufs +
dd->palign * kinfo->spi_piocnt * slave;
}
if (shared) {
kinfo->spi_sendbuf_status =
cvt_kvaddr(&rcd->user_event_mask[subctxt_fp(fp)]);
/* only spi_subctxt_* fields should be set in this block! */
kinfo->spi_subctxt_uregbase = cvt_kvaddr(rcd->subctxt_uregbase);
kinfo->spi_subctxt_rcvegrbuf =
cvt_kvaddr(rcd->subctxt_rcvegrbuf);
kinfo->spi_subctxt_rcvhdr_base =
cvt_kvaddr(rcd->subctxt_rcvhdr_base);
}
/*
* All user buffers are 2KB buffers. If we ever support
* giving 4KB buffers to user processes, this will need some
* work. Can't use piobufbase directly, because it has
* both 2K and 4K buffer base values.
*/
kinfo->spi_pioindex = (kinfo->spi_piobufbase - dd->pio2k_bufbase) /
dd->palign;
kinfo->spi_pioalign = dd->palign;
kinfo->spi_qpair = QIB_KD_QP;
/*
* user mode PIO buffers are always 2KB, even when 4KB can
* be received, and sent via the kernel; this is ibmaxlen
* for 2K MTU.
*/
kinfo->spi_piosize = dd->piosize2k - 2 * sizeof(u32);
kinfo->spi_mtu = ppd->ibmaxlen; /* maxlen, not ibmtu */
kinfo->spi_ctxt = rcd->ctxt;
kinfo->spi_subctxt = subctxt_fp(fp);
kinfo->spi_sw_version = QIB_KERN_SWVERSION;
kinfo->spi_sw_version |= 1U << 31; /* QLogic-built, not kernel.org */
kinfo->spi_hw_version = dd->revision;
if (master)
kinfo->spi_runtime_flags |= QIB_RUNTIME_MASTER;
sz = (ubase_size < sizeof(*kinfo)) ? ubase_size : sizeof(*kinfo);
if (copy_to_user(ubase, kinfo, sz))
ret = -EFAULT;
bail:
kfree(kinfo);
return ret;
}
| 2,116 |
41,081 | 0 | static int __init futex_init(void)
{
u32 curval;
int i;
/*
* This will fail and we want it. Some arch implementations do
* runtime detection of the futex_atomic_cmpxchg_inatomic()
* functionality. We want to know that before we call in any
* of the complex code paths. Also we want to prevent
* registration of robust lists in that case. NULL is
* guaranteed to fault and we get -EFAULT on functional
* implementation, the non-functional ones will return
* -ENOSYS.
*/
if (cmpxchg_futex_value_locked(&curval, NULL, 0, 0) == -EFAULT)
futex_cmpxchg_enabled = 1;
for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
plist_head_init(&futex_queues[i].chain);
spin_lock_init(&futex_queues[i].lock);
}
return 0;
}
| 2,117 |
148,152 | 0 | void V8TestObject::VoidMethodShortArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodShortArg");
test_object_v8_internal::VoidMethodShortArgMethod(info);
}
| 2,118 |
187,060 | 1 | bool ReceiverWasAdded(const RtpTransceiverState& transceiver_state) {
uintptr_t receiver_id = RTCRtpReceiver::getId(
transceiver_state.receiver_state()->webrtc_receiver().get());
for (const auto& receiver : handler_->rtp_receivers_) {
if (receiver->Id() == receiver_id)
return false;
}
return true;
}
| 2,119 |
115,258 | 0 | void OmniboxViewWin::OnPaste() {
const string16 text(GetClipboardText());
if (!text.empty()) {
model_->on_paste();
text_before_change_.clear();
ReplaceSel(text.c_str(), true);
}
}
| 2,120 |
153,772 | 0 | void GLES2Implementation::MultiDrawArraysWEBGL(GLenum mode,
const GLint* firsts,
const GLsizei* counts,
GLsizei drawcount) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMultiDrawArraysWEBGL("
<< GLES2Util::GetStringDrawMode(mode) << ", " << firsts
<< ", " << counts << ", " << drawcount << ")");
if (drawcount < 0) {
SetGLError(GL_INVALID_VALUE, "glMultiDrawArraysWEBGL", "drawcount < 0");
return;
}
if (drawcount == 0) {
return;
}
if (vertex_array_object_manager_->SupportsClientSideBuffers()) {
SetGLError(GL_INVALID_OPERATION, "glMultiDrawArraysWEBGL",
"Missing array buffer for vertex attribute");
return;
}
MultiDrawArraysWEBGLHelper(mode, firsts, counts, drawcount);
CheckGLError();
}
| 2,121 |
117,172 | 0 | virtual bool detach()
{
m_events.append(Detach);
return TRUE;
}
| 2,122 |
116,769 | 0 | void RenderViewTest::SendContentStateImmediately() {
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
impl->set_send_content_state_immediately(true);
}
| 2,123 |
92,422 | 0 | static int font_load_and_wait(const char *vc, const char *font, const char *map, const char *unimap) {
const char *args[9];
unsigned i = 0;
pid_t pid;
int r;
/* Any part can be set independently */
if (isempty(font) && isempty(map) && isempty(unimap))
return 0;
args[i++] = KBD_SETFONT;
args[i++] = "-C";
args[i++] = vc;
if (!isempty(map)) {
args[i++] = "-m";
args[i++] = map;
}
if (!isempty(unimap)) {
args[i++] = "-u";
args[i++] = unimap;
}
if (!isempty(font))
args[i++] = font;
args[i++] = NULL;
if (DEBUG_LOGGING) {
_cleanup_free_ char *cmd;
cmd = strv_join((char**) args, " ");
log_debug("Executing \"%s\"...", strnull(cmd));
}
r = safe_fork("(setfont)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pid);
if (r < 0)
return r;
if (r == 0) {
execv(args[0], (char **) args);
_exit(EXIT_FAILURE);
}
return wait_for_terminate_and_check(KBD_SETFONT, pid, WAIT_LOG);
}
| 2,124 |
20,851 | 0 | static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
u32 kvm_nr_mmu_pages)
{
if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES)
return -EINVAL;
mutex_lock(&kvm->slots_lock);
spin_lock(&kvm->mmu_lock);
kvm_mmu_change_mmu_pages(kvm, kvm_nr_mmu_pages);
kvm->arch.n_requested_mmu_pages = kvm_nr_mmu_pages;
spin_unlock(&kvm->mmu_lock);
mutex_unlock(&kvm->slots_lock);
return 0;
}
| 2,125 |
154,614 | 0 | error::Error GLES2DecoderPassthroughImpl::DoCreateShader(GLenum type,
GLuint client_id) {
return CreateHelper(client_id, &resources_->shader_id_map,
[this, type]() { return api()->glCreateShaderFn(type); });
}
| 2,126 |
95,177 | 0 | static void cmd_undump(char *tag, char *name)
{
int r = 0;
char *intname = mboxname_from_external(name, &imapd_namespace, imapd_userid);
/* administrators only please */
if (!imapd_userisadmin)
r = IMAP_PERMISSION_DENIED;
if (!r) r = mlookup(tag, name, intname, NULL);
if (!r) r = undump_mailbox(intname, imapd_in, imapd_out, imapd_authstate);
if (r) {
prot_printf(imapd_out, "%s NO %s%s\r\n",
tag,
(r == IMAP_MAILBOX_NONEXISTENT &&
mboxlist_createmailboxcheck(intname, 0, 0,
imapd_userisadmin,
imapd_userid, imapd_authstate,
NULL, NULL, 0) == 0)
? "[TRYCREATE] " : "", error_message(r));
} else {
prot_printf(imapd_out, "%s OK %s\r\n", tag,
error_message(IMAP_OK_COMPLETED));
}
free(intname);
}
| 2,127 |
152,070 | 0 | void RenderFrameHostImpl::ResetNavigationRequests() {
navigation_request_.reset();
same_document_navigation_request_.reset();
navigation_requests_.clear();
}
| 2,128 |
6,536 | 0 | kwsalloc (char const *trans)
{
struct kwset *kwset;
kwset = (struct kwset *) malloc(sizeof (struct kwset));
if (!kwset)
return NULL;
obstack_init(&kwset->obstack);
kwset->words = 0;
kwset->trie
= (struct trie *) obstack_alloc(&kwset->obstack, sizeof (struct trie));
if (!kwset->trie)
{
kwsfree((kwset_t) kwset);
return NULL;
}
kwset->trie->accepting = 0;
kwset->trie->links = NULL;
kwset->trie->parent = NULL;
kwset->trie->next = NULL;
kwset->trie->fail = NULL;
kwset->trie->depth = 0;
kwset->trie->shift = 0;
kwset->mind = INT_MAX;
kwset->maxd = -1;
kwset->target = NULL;
kwset->trans = trans;
return (kwset_t) kwset;
}
| 2,129 |
131,402 | 0 | static void htmlCollectionAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectPythonV8Internal::htmlCollectionAttributeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 2,130 |
169,032 | 0 | void OfflinePageModelImpl::AddPage(const OfflinePageItem& page,
const AddPageCallback& callback) {
RunWhenLoaded(base::Bind(&OfflinePageModelImpl::AddPageWhenLoadDone,
weak_ptr_factory_.GetWeakPtr(), page, callback));
}
| 2,131 |
155,880 | 0 | views::Link* CreateLink(const base::string16& link_text,
views::LinkListener* listener) {
views::Link* link_button = new views::Link(link_text);
link_button->SetHorizontalAlignment(gfx::ALIGN_LEFT);
link_button->SetUnderline(false);
link_button->set_listener(listener);
return link_button;
}
| 2,132 |
176,737 | 0 | status_t Parcel::readByteVector(std::vector<int8_t>* val) const {
return readByteVectorInternal(this, val);
}
| 2,133 |
93,794 | 0 | virDomainGetBlkioParameters(virDomainPtr domain,
virTypedParameterPtr params,
int *nparams, unsigned int flags)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d, flags=%x",
params, (nparams) ? *nparams : -1, flags);
virResetLastError();
virCheckDomainReturn(domain, -1);
virCheckNonNullArgGoto(nparams, error);
virCheckNonNegativeArgGoto(*nparams, error);
if (*nparams != 0)
virCheckNonNullArgGoto(params, error);
if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn,
VIR_DRV_FEATURE_TYPED_PARAM_STRING))
flags |= VIR_TYPED_PARAM_STRING_OKAY;
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_AFFECT_LIVE,
VIR_DOMAIN_AFFECT_CONFIG,
error);
conn = domain->conn;
if (conn->driver->domainGetBlkioParameters) {
int ret;
ret = conn->driver->domainGetBlkioParameters(domain, params, nparams, flags);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(domain->conn);
return -1;
}
| 2,134 |
23,189 | 0 | struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp)
{
struct nfs4_session *session;
struct nfs4_slot_table *tbl;
session = kzalloc(sizeof(struct nfs4_session), GFP_NOFS);
if (!session)
return NULL;
tbl = &session->fc_slot_table;
tbl->highest_used_slotid = -1;
spin_lock_init(&tbl->slot_tbl_lock);
rpc_init_priority_wait_queue(&tbl->slot_tbl_waitq, "ForeChannel Slot table");
init_completion(&tbl->complete);
tbl = &session->bc_slot_table;
tbl->highest_used_slotid = -1;
spin_lock_init(&tbl->slot_tbl_lock);
rpc_init_wait_queue(&tbl->slot_tbl_waitq, "BackChannel Slot table");
init_completion(&tbl->complete);
session->session_state = 1<<NFS4_SESSION_INITING;
session->clp = clp;
return session;
}
| 2,135 |
139,229 | 0 | RenderProcessHostImpl::TakeMetricsAllocator() {
return std::move(metrics_allocator_);
}
| 2,136 |
7,255 | 0 | static void php_cgi_ini_activate_user_config(char *path, int path_len, const char *doc_root, int doc_root_len, int start TSRMLS_DC)
{
char *ptr;
user_config_cache_entry *new_entry, *entry;
time_t request_time = sapi_get_request_time(TSRMLS_C);
/* Find cached config entry: If not found, create one */
if (zend_hash_find(&CGIG(user_config_cache), path, path_len + 1, (void **) &entry) == FAILURE) {
new_entry = pemalloc(sizeof(user_config_cache_entry), 1);
new_entry->expires = 0;
new_entry->user_config = (HashTable *) pemalloc(sizeof(HashTable), 1);
zend_hash_init(new_entry->user_config, 0, NULL, (dtor_func_t) config_zval_dtor, 1);
zend_hash_update(&CGIG(user_config_cache), path, path_len + 1, new_entry, sizeof(user_config_cache_entry), (void **) &entry);
free(new_entry);
}
/* Check whether cache entry has expired and rescan if it is */
if (request_time > entry->expires) {
char *real_path = NULL;
int real_path_len;
char *s1, *s2;
int s_len;
/* Clear the expired config */
zend_hash_clean(entry->user_config);
if (!IS_ABSOLUTE_PATH(path, path_len)) {
real_path = tsrm_realpath(path, NULL TSRMLS_CC);
if (real_path == NULL) {
return;
}
real_path_len = strlen(real_path);
path = real_path;
path_len = real_path_len;
}
if (path_len > doc_root_len) {
s1 = (char *) doc_root;
s2 = path;
s_len = doc_root_len;
} else {
s1 = path;
s2 = (char *) doc_root;
s_len = path_len;
}
/* we have to test if path is part of DOCUMENT_ROOT.
if it is inside the docroot, we scan the tree up to the docroot
to find more user.ini, if not we only scan the current path.
*/
#ifdef PHP_WIN32
if (strnicmp(s1, s2, s_len) == 0) {
#else
if (strncmp(s1, s2, s_len) == 0) {
#endif
ptr = s2 + start; /* start is the point where doc_root ends! */
while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) {
*ptr = 0;
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC);
*ptr = '/';
ptr++;
}
} else {
php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC);
}
if (real_path) {
free(real_path);
}
entry->expires = request_time + PG(user_ini_cache_ttl);
}
/* Activate ini entries with values from the user config hash */
php_ini_activate_config(entry->user_config, PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS TSRMLS_CC);
}
/* }}} */
static int sapi_cgi_activate(TSRMLS_D)
{
char *path, *doc_root, *server_name;
uint path_len, doc_root_len, server_name_len;
/* PATH_TRANSLATED should be defined at this stage but better safe than sorry :) */
if (!SG(request_info).path_translated) {
| 2,137 |
140,677 | 0 | base::string16 GetDisplaySize(int64_t display_id) {
display::DisplayManager* display_manager = GetDisplayManager();
const display::Display* display =
&display_manager->GetDisplayForId(display_id);
bool mirroring = display_manager->mirroring_display_id() == display_id;
DCHECK(!mirroring);
if (mirroring)
return base::string16();
DCHECK(display->is_valid());
return base::UTF8ToUTF16(display->size().ToString());
}
| 2,138 |
118,816 | 0 | bool WebContentsImpl::AddMessageToConsole(int32 level,
const string16& message,
int32 line_no,
const string16& source_id) {
if (!delegate_)
return false;
return delegate_->AddMessageToConsole(this, level, message, line_no,
source_id);
}
| 2,139 |
115,808 | 0 | FakeMalwareDetails* get_details() {
return details_;
}
| 2,140 |
113,822 | 0 | void AddPluginDllEvictionPolicy(sandbox::TargetPolicy* policy) {
for (int ix = 0; ix != arraysize(kTroublesomePluginDlls); ++ix)
BlacklistAddOneDll(kTroublesomePluginDlls[ix], false, policy);
}
| 2,141 |
107,093 | 0 | QQuickWebViewPrivate::~QQuickWebViewPrivate()
{
webPageProxy->close();
}
| 2,142 |
68,240 | 0 | read_object (FILE *in)
{
Attr *attr = NULL;
/* peek to see if there is more to read from this stream */
int tmp_char = fgetc(in);
if (tmp_char == -1) return NULL;
ungetc(tmp_char, in);
attr = attr_read (in);
return attr;
}
| 2,143 |
114,715 | 0 | NetworkActionPredictor::TransitionalMatch::~TransitionalMatch() {
}
| 2,144 |
5,779 | 0 | static void ehci_caps_write(void *ptr, hwaddr addr,
uint64_t val, unsigned size)
{
}
| 2,145 |
33,173 | 0 | static int xfrm_send_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
__be16 sport)
{
struct net *net = xs_net(x);
struct sk_buff *skb;
if (x->id.proto != IPPROTO_ESP)
return -EINVAL;
if (!x->encap)
return -EINVAL;
skb = nlmsg_new(xfrm_mapping_msgsize(), GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
if (build_mapping(skb, x, ipaddr, sport) < 0)
BUG();
return nlmsg_multicast(net->xfrm.nlsk, skb, 0, XFRMNLGRP_MAPPING, GFP_ATOMIC);
}
| 2,146 |
157,878 | 0 | void WebContentsImpl::UpdateRenderViewSizeForRenderManager(bool is_main_frame) {
gfx::Size size = GetSizeForNewRenderView(is_main_frame);
if (!size.IsEmpty())
view_->SizeContents(size);
}
| 2,147 |
164,272 | 0 | ActiveTabManagedSessionTest() {}
| 2,148 |
84,401 | 0 | get_ping_buffer_for_header (Header *header)
{
Buffer *buffer;
GDBusMessage *dummy;
dummy = g_dbus_message_new_method_call (NULL, "/", "org.freedesktop.DBus.Peer", "Ping");
g_dbus_message_set_serial (dummy, header->serial);
g_dbus_message_set_flags (dummy, header->flags);
buffer = message_to_buffer (dummy);
g_object_unref (dummy);
return buffer;
}
| 2,149 |
80,329 | 0 | GF_Err pdin_Size(GF_Box *s)
{
GF_ProgressiveDownloadBox *ptr = (GF_ProgressiveDownloadBox *)s;
ptr->size += 8*ptr->count;
return GF_OK;
}
| 2,150 |
127,479 | 0 | void JPEGImageDecoder::decode(bool onlySize)
{
if (failed())
return;
if (!m_reader)
m_reader = adoptPtr(new JPEGImageReader(this));
if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
setFailed();
else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() == ImageFrame::FrameComplete))
m_reader.clear();
}
| 2,151 |
103,067 | 0 | virtual ~TabStripDummyDelegate() {}
| 2,152 |
31,259 | 0 | int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
{
unsigned int alignmask = walk->alignmask;
unsigned int nbytes = walk->entrylen;
walk->data -= walk->offset;
if (nbytes && walk->offset & alignmask && !err) {
walk->offset = ALIGN(walk->offset, alignmask + 1);
walk->data += walk->offset;
nbytes = min(nbytes,
((unsigned int)(PAGE_SIZE)) - walk->offset);
walk->entrylen -= nbytes;
return nbytes;
}
kunmap_atomic(walk->data);
crypto_yield(walk->flags);
if (err)
return err;
if (nbytes) {
walk->offset = 0;
walk->pg++;
return hash_walk_next(walk);
}
if (!walk->total)
return 0;
walk->sg = scatterwalk_sg_next(walk->sg);
return hash_walk_new_entry(walk);
}
| 2,153 |
164,783 | 0 | static bool CheckCaf(const uint8_t* buffer, int buffer_size) {
RCHECK(buffer_size >= 52);
BitReader reader(buffer, buffer_size);
RCHECK(ReadBits(&reader, 32) == TAG('c', 'a', 'f', 'f'));
RCHECK(ReadBits(&reader, 16) == 1);
reader.SkipBits(16);
RCHECK(ReadBits(&reader, 32) == TAG('d', 'e', 's', 'c'));
RCHECK(ReadBits(&reader, 64) == 32);
RCHECK(ReadBits(&reader, 64) != 0);
RCHECK(ReadBits(&reader, 32) != 0);
reader.SkipBits(32 + 32);
RCHECK(ReadBits(&reader, 32) != 0);
return true;
}
| 2,154 |
15,316 | 0 | static PHP_FUNCTION(xmlwriter_start_dtd)
{
zval *pind;
xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL;
int name_len, pubid_len, sysid_len, retval;
#ifdef ZEND_ENGINE_2
zval *this = getThis();
if (this) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!", &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
return;
}
XMLWRITER_FROM_OBJECT(intern, this);
} else
#endif
{
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(intern,xmlwriter_object *, &pind, -1, "XMLWriter", le_xmlwriter);
}
ptr = intern->ptr;
if (ptr) {
retval = xmlTextWriterStartDTD(ptr, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid);
if (retval != -1) {
RETURN_TRUE;
}
}
RETURN_FALSE;
}
| 2,155 |
122,638 | 0 | void Extension::GetBasicInfo(bool enabled,
DictionaryValue* info) const {
info->SetString(info_keys::kIdKey, id());
info->SetString(info_keys::kNameKey, name());
info->SetBoolean(info_keys::kEnabledKey, enabled);
info->SetBoolean(info_keys::kOfflineEnabledKey, offline_enabled());
info->SetString(info_keys::kVersionKey, VersionString());
info->SetString(info_keys::kDescriptionKey, description());
info->SetString(info_keys::kOptionsUrlKey,
ManifestURL::GetOptionsPage(this).possibly_invalid_spec());
info->SetString(info_keys::kHomepageUrlKey,
ManifestURL::GetHomepageURL(this).possibly_invalid_spec());
info->SetString(info_keys::kDetailsUrlKey,
ManifestURL::GetDetailsURL(this).possibly_invalid_spec());
info->SetBoolean(info_keys::kPackagedAppKey, is_platform_app());
}
| 2,156 |
93,543 | 0 | static int ip6mr_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
struct nlattr **tb)
{
return 1;
}
| 2,157 |
173,606 | 0 | status_t NuPlayer::GenericSource::seekTo(int64_t seekTimeUs) {
sp<AMessage> msg = new AMessage(kWhatSeek, this);
msg->setInt64("seekTimeUs", seekTimeUs);
sp<AMessage> response;
status_t err = msg->postAndAwaitResponse(&response);
if (err == OK && response != NULL) {
CHECK(response->findInt32("err", &err));
}
return err;
}
| 2,158 |
9,349 | 0 | int SSL_in_init(SSL *s)
{
return s->statem.in_init;
}
| 2,159 |
40,009 | 0 | cifs_relock_file(struct cifsFileInfo *cfile)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb);
struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode);
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
int rc = 0;
down_read(&cinode->lock_sem);
if (cinode->can_cache_brlcks) {
/* can cache locks - no need to relock */
up_read(&cinode->lock_sem);
return rc;
}
if (cap_unix(tcon->ses) &&
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
rc = cifs_push_posix_locks(cfile);
else
rc = tcon->ses->server->ops->push_mand_locks(cfile);
up_read(&cinode->lock_sem);
return rc;
}
| 2,160 |
136,814 | 0 | void LocalDOMWindow::moveBy(int x, int y) const {
if (!GetFrame() || !GetFrame()->IsMainFrame())
return;
Page* page = GetFrame()->GetPage();
if (!page)
return;
IntRect window_rect = page->GetChromeClient().RootWindowRect();
window_rect.SaturatedMove(x, y);
page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, *GetFrame());
}
| 2,161 |
93,846 | 0 | virDomainMemoryPeek(virDomainPtr dom,
unsigned long long start /* really 64 bits */,
size_t size,
void *buffer,
unsigned int flags)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(dom, "start=%lld, size=%zi, buffer=%p, flags=%x",
start, size, buffer, flags);
virResetLastError();
virCheckDomainReturn(dom, -1);
conn = dom->conn;
virCheckReadOnlyGoto(conn->flags, error);
/* Note on access to physical memory: A VIR_MEMORY_PHYSICAL flag is
* a possibility. However it isn't really useful unless the caller
* can also access registers, particularly CR3 on x86 in order to
* get the Page Table Directory. Since registers are different on
* every architecture, that would imply another call to get the
* machine registers.
*
* The QEMU driver handles VIR_MEMORY_VIRTUAL, mapping it
* to the qemu 'memsave' command which does the virtual to physical
* mapping inside qemu.
*
* The QEMU driver also handles VIR_MEMORY_PHYSICAL, mapping it
* to the qemu 'pmemsave' command.
*
* At time of writing there is no Xen driver. However the Xen
* hypervisor only lets you map physical pages from other domains,
* and so the Xen driver would have to do the virtual to physical
* mapping by chasing 2, 3 or 4-level page tables from the PTD.
* There is example code in libxc (xc_translate_foreign_address)
* which does this, although we cannot copy this code directly
* because of incompatible licensing.
*/
VIR_EXCLUSIVE_FLAGS_GOTO(VIR_MEMORY_VIRTUAL, VIR_MEMORY_PHYSICAL, error);
/* Allow size == 0 as an access test. */
if (size > 0)
virCheckNonNullArgGoto(buffer, error);
if (conn->driver->domainMemoryPeek) {
int ret;
ret = conn->driver->domainMemoryPeek(dom, start, size,
buffer, flags);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(dom->conn);
return -1;
}
| 2,162 |
92,465 | 0 | static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
{
u32 divider = LOAD_AVG_MAX - 1024 + cfs_rq->avg.period_contrib;
/*
* When we attach the @se to the @cfs_rq, we must align the decay
* window because without that, really weird and wonderful things can
* happen.
*
* XXX illustrate
*/
se->avg.last_update_time = cfs_rq->avg.last_update_time;
se->avg.period_contrib = cfs_rq->avg.period_contrib;
/*
* Hell(o) Nasty stuff.. we need to recompute _sum based on the new
* period_contrib. This isn't strictly correct, but since we're
* entirely outside of the PELT hierarchy, nobody cares if we truncate
* _sum a little.
*/
se->avg.util_sum = se->avg.util_avg * divider;
se->avg.load_sum = divider;
if (se_weight(se)) {
se->avg.load_sum =
div_u64(se->avg.load_avg * se->avg.load_sum, se_weight(se));
}
se->avg.runnable_load_sum = se->avg.load_sum;
enqueue_load_avg(cfs_rq, se);
cfs_rq->avg.util_avg += se->avg.util_avg;
cfs_rq->avg.util_sum += se->avg.util_sum;
add_tg_cfs_propagate(cfs_rq, se->avg.load_sum);
cfs_rq_util_change(cfs_rq, flags);
}
| 2,163 |
33,013 | 0 | static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len,
char __user *optval,
int __user *optlen)
{
struct sctp_paddrinfo pinfo;
struct sctp_transport *transport;
int retval = 0;
if (len < sizeof(pinfo)) {
retval = -EINVAL;
goto out;
}
len = sizeof(pinfo);
if (copy_from_user(&pinfo, optval, len)) {
retval = -EFAULT;
goto out;
}
transport = sctp_addr_id2transport(sk, &pinfo.spinfo_address,
pinfo.spinfo_assoc_id);
if (!transport)
return -EINVAL;
pinfo.spinfo_assoc_id = sctp_assoc2id(transport->asoc);
pinfo.spinfo_state = transport->state;
pinfo.spinfo_cwnd = transport->cwnd;
pinfo.spinfo_srtt = transport->srtt;
pinfo.spinfo_rto = jiffies_to_msecs(transport->rto);
pinfo.spinfo_mtu = transport->pathmtu;
if (pinfo.spinfo_state == SCTP_UNKNOWN)
pinfo.spinfo_state = SCTP_ACTIVE;
if (put_user(len, optlen)) {
retval = -EFAULT;
goto out;
}
if (copy_to_user(optval, &pinfo, len)) {
retval = -EFAULT;
goto out;
}
out:
return retval;
}
| 2,164 |
14,198 | 0 | static zend_object_value zend_default_exception_new_ex(zend_class_entry *class_type, int skip_top_traces TSRMLS_DC) /* {{{ */
{
zval obj;
zend_object *object;
zval *trace;
Z_OBJVAL(obj) = zend_objects_new(&object, class_type TSRMLS_CC);
Z_OBJ_HT(obj) = &default_exception_handlers;
object_properties_init(object, class_type);
ALLOC_ZVAL(trace);
Z_UNSET_ISREF_P(trace);
Z_SET_REFCOUNT_P(trace, 0);
zend_fetch_debug_backtrace(trace, skip_top_traces, 0, 0 TSRMLS_CC);
zend_update_property_string(default_exception_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(default_exception_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
zend_update_property(default_exception_ce, &obj, "trace", sizeof("trace")-1, trace TSRMLS_CC);
return Z_OBJVAL(obj);
}
/* }}} */
| 2,165 |
83,462 | 0 | X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
{
param->check_time = t;
param->flags |= X509_V_FLAG_USE_CHECK_TIME;
}
| 2,166 |
187,271 | 1 | void RenderFrameDevToolsAgentHost::DestroyOnRenderFrameGone() {
scoped_refptr<RenderFrameDevToolsAgentHost> protect(this);
if (IsAttached())
RevokePolicy();
ForceDetachAllClients();
frame_host_ = nullptr;
agent_ptr_.reset();
SetFrameTreeNode(nullptr);
Release();
}
| 2,167 |
67,828 | 0 | void DefragTrackerFree(DefragTracker *dt)
{
if (dt != NULL) {
DefragTrackerClearMemory(dt);
SCMutexDestroy(&dt->lock);
SCFree(dt);
(void) SC_ATOMIC_SUB(defrag_memuse, sizeof(DefragTracker));
}
}
| 2,168 |
148,936 | 0 | static void Cleanup(Vdbe *p){
sqlite3 *db = p->db;
#ifdef SQLITE_DEBUG
/* Execute assert() statements to ensure that the Vdbe.apCsr[] and
** Vdbe.aMem[] arrays have already been cleaned up. */
int i;
if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
if( p->aMem ){
for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
}
#endif
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = 0;
p->pResultSet = 0;
}
| 2,169 |
174,549 | 0 | void BTM_PasskeyReqReply(tBTM_STATUS res, BD_ADDR bd_addr, UINT32 passkey)
{
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_API ("BTM_PasskeyReqReply: State: %s res:%d",
btm_pair_state_descr(btm_cb.pairing_state), res);
if ( (btm_cb.pairing_state == BTM_PAIR_STATE_IDLE)
|| (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) )
{
return;
}
/* If timeout already expired or has been canceled, ignore the reply */
if ( (btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) && (res != BTM_SUCCESS) )
{
if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL)
{
btm_cb.acl_disc_reason = HCI_ERR_HOST_REJECT_SECURITY;
if (p_dev_rec->hci_handle != BTM_SEC_INVALID_HANDLE)
btm_sec_send_hci_disconnect (p_dev_rec, HCI_ERR_AUTH_FAILURE, p_dev_rec->hci_handle);
else
BTM_SecBondCancel(bd_addr);
p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_AUTHED | BTM_SEC_LINK_KEY_KNOWN);
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
return;
}
}
else if (btm_cb.pairing_state != BTM_PAIR_STATE_KEY_ENTRY)
return;
if (passkey > BTM_MAX_PASSKEY_VAL)
res = BTM_ILLEGAL_VALUE;
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
if (res != BTM_SUCCESS)
{
/* use BTM_PAIR_STATE_WAIT_AUTH_COMPLETE to report authentication failed event */
btm_cb.acl_disc_reason = HCI_ERR_HOST_REJECT_SECURITY;
btsnd_hcic_user_passkey_neg_reply (bd_addr);
}
else
{
btm_cb.acl_disc_reason = HCI_SUCCESS;
btsnd_hcic_user_passkey_reply (bd_addr, passkey);
}
}
| 2,170 |
36,823 | 0 | int inode_newsize_ok(const struct inode *inode, loff_t offset)
{
if (inode->i_size < offset) {
unsigned long limit;
limit = rlimit(RLIMIT_FSIZE);
if (limit != RLIM_INFINITY && offset > limit)
goto out_sig;
if (offset > inode->i_sb->s_maxbytes)
goto out_big;
} else {
/*
* truncation of in-use swapfiles is disallowed - it would
* cause subsequent swapout to scribble on the now-freed
* blocks.
*/
if (IS_SWAPFILE(inode))
return -ETXTBSY;
}
return 0;
out_sig:
send_sig(SIGXFSZ, current, 0);
out_big:
return -EFBIG;
}
| 2,171 |
170,306 | 0 | UsbChooserContext::GetGrantedObjects(const GURL& requesting_origin,
const GURL& embedding_origin) {
std::vector<std::unique_ptr<base::DictionaryValue>> objects =
ChooserContextBase::GetGrantedObjects(requesting_origin,
embedding_origin);
if (CanRequestObjectPermission(requesting_origin, embedding_origin)) {
auto it = ephemeral_devices_.find(
std::make_pair(requesting_origin, embedding_origin));
if (it != ephemeral_devices_.end()) {
for (const std::string& guid : it->second) {
auto dict_it = ephemeral_dicts_.find(guid);
DCHECK(dict_it != ephemeral_dicts_.end());
objects.push_back(dict_it->second.CreateDeepCopy());
}
}
}
return objects;
}
| 2,172 |
143,582 | 0 | void OomInterventionTabHelper::StopMonitoring() {
if (OomInterventionConfig::GetInstance()->should_detect_in_renderer()) {
ResetInterfaces();
} else {
subscription_.reset();
}
}
| 2,173 |
60,891 | 0 | extension_info_start (NautilusDirectory *directory,
NautilusFile *file,
gboolean *doing_io)
{
NautilusInfoProvider *provider;
NautilusOperationResult result;
NautilusOperationHandle *handle;
GClosure *update_complete;
if (directory->details->extension_info_in_progress != NULL)
{
*doing_io = TRUE;
return;
}
if (!is_needy (file, lacks_extension_info, REQUEST_EXTENSION_INFO))
{
return;
}
*doing_io = TRUE;
if (!async_job_start (directory, "extension info"))
{
return;
}
provider = file->details->pending_info_providers->data;
update_complete = g_cclosure_new (G_CALLBACK (info_provider_callback),
directory,
NULL);
g_closure_set_marshal (update_complete,
g_cclosure_marshal_generic);
result = nautilus_info_provider_update_file_info
(provider,
NAUTILUS_FILE_INFO (file),
update_complete,
&handle);
g_closure_unref (update_complete);
if (result == NAUTILUS_OPERATION_COMPLETE ||
result == NAUTILUS_OPERATION_FAILED)
{
finish_info_provider (directory, file, provider);
async_job_end (directory, "extension info");
}
else
{
directory->details->extension_info_in_progress = handle;
directory->details->extension_info_provider = provider;
directory->details->extension_info_file = file;
}
}
| 2,174 |
59,902 | 0 | static void uas_free_unsubmitted_urbs(struct scsi_cmnd *cmnd)
{
struct uas_cmd_info *cmdinfo;
if (!cmnd)
return;
cmdinfo = (void *)&cmnd->SCp;
if (cmdinfo->state & SUBMIT_CMD_URB)
usb_free_urb(cmdinfo->cmd_urb);
/* data urbs may have never gotten their submit flag set */
if (!(cmdinfo->state & DATA_IN_URB_INFLIGHT))
usb_free_urb(cmdinfo->data_in_urb);
if (!(cmdinfo->state & DATA_OUT_URB_INFLIGHT))
usb_free_urb(cmdinfo->data_out_urb);
}
| 2,175 |
107,574 | 0 | void ewk_view_paint_context_clip(Ewk_View_Paint_Context* context, const Eina_Rectangle* area)
{
EINA_SAFETY_ON_NULL_RETURN(context);
EINA_SAFETY_ON_NULL_RETURN(area);
context->graphicContext->clip(WebCore::IntRect(area->x, area->y, area->w, area->h));
}
| 2,176 |
41,337 | 0 | static void emulator_set_cached_descriptor(struct desc_struct *desc, int seg,
struct kvm_vcpu *vcpu)
{
struct kvm_segment var;
/* needed to preserve selector */
kvm_get_segment(vcpu, &var, seg);
var.base = get_desc_base(desc);
var.limit = get_desc_limit(desc);
if (desc->g)
var.limit = (var.limit << 12) | 0xfff;
var.type = desc->type;
var.present = desc->p;
var.dpl = desc->dpl;
var.db = desc->d;
var.s = desc->s;
var.l = desc->l;
var.g = desc->g;
var.avl = desc->avl;
var.present = desc->p;
var.unusable = !var.present;
var.padding = 0;
kvm_set_segment(vcpu, &var, seg);
return;
}
| 2,177 |
135,275 | 0 | void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
{
ASSERT(inStyleRecalc());
ASSERT(documentElement());
bool didRecalcDocumentElement = false;
RefPtr<ComputedStyle> documentElementStyle = documentElement()->mutableComputedStyle();
if (change == Force)
documentElement()->clearAnimationStyleChange();
if (!documentElementStyle || documentElement()->needsStyleRecalc() || change == Force) {
documentElementStyle = ensureStyleResolver().styleForElement(documentElement());
didRecalcDocumentElement = true;
}
WritingMode rootWritingMode = documentElementStyle->writingMode();
TextDirection rootDirection = documentElementStyle->direction();
HTMLElement* body = this->body();
RefPtr<ComputedStyle> bodyStyle;
if (body) {
bodyStyle = body->mutableComputedStyle();
if (didRecalcDocumentElement)
body->clearAnimationStyleChange();
if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement)
bodyStyle = ensureStyleResolver().styleForElement(body, documentElementStyle.get());
rootWritingMode = bodyStyle->writingMode();
rootDirection = bodyStyle->direction();
}
const ComputedStyle* backgroundStyle = documentElementStyle.get();
if (isHTMLHtmlElement(documentElement()) && isHTMLBodyElement(body) && !backgroundStyle->hasBackground())
backgroundStyle = bodyStyle.get();
Color backgroundColor = backgroundStyle->visitedDependentColor(CSSPropertyBackgroundColor);
FillLayer backgroundLayers = backgroundStyle->backgroundLayers();
for (auto currentLayer = &backgroundLayers; currentLayer; currentLayer = currentLayer->next()) {
currentLayer->setClip(BorderFillBox);
if (currentLayer->attachment() == ScrollBackgroundAttachment)
currentLayer->setAttachment(LocalBackgroundAttachment);
}
EImageRendering imageRendering = backgroundStyle->imageRendering();
const ComputedStyle* overflowStyle = nullptr;
if (Element* element = viewportDefiningElement(documentElementStyle.get())) {
if (element == body) {
overflowStyle = bodyStyle.get();
} else {
ASSERT(element == documentElement());
overflowStyle = documentElementStyle.get();
if (bodyStyle && !bodyStyle->isOverflowVisible())
UseCounter::count(*this, UseCounter::BodyScrollsInAdditionToViewport);
}
}
if (styleEngine().usesRemUnits() && (documentElement()->needsAttach() || !documentElement()->computedStyle() || documentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize())) {
ensureStyleResolver().invalidateMatchedPropertiesCache();
documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::FontSizeChange));
}
EOverflow overflowX = OAUTO;
EOverflow overflowY = OAUTO;
float columnGap = 0;
if (overflowStyle) {
overflowX = overflowStyle->overflowX();
overflowY = overflowStyle->overflowY();
if (overflowX == OVISIBLE)
overflowX = OAUTO;
if (overflowY == OVISIBLE)
overflowY = OAUTO;
columnGap = overflowStyle->columnGap();
}
RefPtr<ComputedStyle> documentStyle = layoutView()->mutableStyle();
if (documentStyle->writingMode() != rootWritingMode
|| documentStyle->direction() != rootDirection
|| documentStyle->visitedDependentColor(CSSPropertyBackgroundColor) != backgroundColor
|| documentStyle->backgroundLayers() != backgroundLayers
|| documentStyle->imageRendering() != imageRendering
|| documentStyle->overflowX() != overflowX
|| documentStyle->overflowY() != overflowY
|| documentStyle->columnGap() != columnGap) {
RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*documentStyle);
newStyle->setWritingMode(rootWritingMode);
newStyle->setDirection(rootDirection);
newStyle->setBackgroundColor(backgroundColor);
newStyle->accessBackgroundLayers() = backgroundLayers;
newStyle->setImageRendering(imageRendering);
newStyle->setOverflowX(overflowX);
newStyle->setOverflowY(overflowY);
newStyle->setColumnGap(columnGap);
layoutView()->setStyle(newStyle);
setupFontBuilder(*newStyle);
}
if (body) {
if (const ComputedStyle* style = body->computedStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
body->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
}
if (const ComputedStyle* style = documentElement()->computedStyle()) {
if (style->direction() != rootDirection || style->writingMode() != rootWritingMode)
documentElement()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::WritingModeChange));
}
}
| 2,178 |
98,521 | 0 | GdkColor NormalURLColor(GdkColor foreground) {
color_utils::HSL fg_hsl;
color_utils::SkColorToHSL(gfx::GdkColorToSkColor(foreground), &fg_hsl);
color_utils::HSL hue_hsl;
color_utils::SkColorToHSL(gfx::GdkColorToSkColor(kURLTextColor), &hue_hsl);
double s = std::max(0.5, fg_hsl.s);
double l;
if (fg_hsl.l < hue_hsl.l)
l = hue_hsl.l;
else
l = (fg_hsl.l + hue_hsl.l) / 2;
color_utils::HSL output = { hue_hsl.h, s, l };
return gfx::SkColorToGdkColor(color_utils::HSLToSkColor(output, 255));
}
| 2,179 |
154,666 | 0 | error::Error GLES2DecoderPassthroughImpl::DoGenRenderbuffers(
GLsizei n,
volatile GLuint* renderbuffers) {
return GenHelper(n, renderbuffers, &resources_->renderbuffer_id_map,
[this](GLsizei n, GLuint* renderbuffers) {
api()->glGenRenderbuffersEXTFn(n, renderbuffers);
});
}
| 2,180 |
117,333 | 0 | xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) {
xmlXPathObjectPtr ret;
if (start == NULL)
return(NULL);
if (end == NULL)
return(NULL);
if (start->type != XPATH_POINT)
return(NULL);
ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
if (ret == NULL) {
xmlXPtrErrMemory("allocating range");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
ret->type = XPATH_RANGE;
ret->user = start->user;
ret->index = start->index;
ret->user2 = end;
ret->index2 = -1;
xmlXPtrRangeCheckOrder(ret);
return(ret);
}
| 2,181 |
148,506 | 0 | void WebContentsImpl::OnShowValidationMessage(
RenderViewHostImpl* source,
const gfx::Rect& anchor_in_root_view,
const base::string16& main_text,
const base::string16& sub_text) {
if (delegate_)
delegate_->ShowValidationMessage(
this, anchor_in_root_view, main_text, sub_text);
}
| 2,182 |
132,595 | 0 | void WebKitTestResultPrinter::PrintAudioHeader() {
DCHECK_EQ(state_, DURING_TEST);
if (!capture_text_only_)
*output_ << "Content-Type: audio/wav\n";
state_ = IN_AUDIO_BLOCK;
}
| 2,183 |
154,320 | 0 | void GLES2DecoderImpl::PerformIdleWork() {
gpu_tracer_->ProcessTraces();
ProcessPendingReadPixels(false);
}
| 2,184 |
104,001 | 0 | void GLES2DecoderImpl::DoClear(GLbitfield mask) {
if (CheckFramebufferComplete("glClear")) {
ApplyDirtyState();
glClear(mask);
}
}
| 2,185 |
7,080 | 0 | t42_parse_sfnts( T42_Face face,
T42_Loader loader )
{
T42_Parser parser = &loader->parser;
FT_Memory memory = parser->root.memory;
FT_Byte* cur;
FT_Byte* limit = parser->root.limit;
FT_Error error;
FT_Int num_tables = 0;
FT_ULong count;
FT_Long n, string_size, old_string_size, real_size;
FT_Byte* string_buf = NULL;
FT_Bool allocated = 0;
T42_Load_Status status;
/* The format is */
/* */
/* /sfnts [ <hexstring> <hexstring> ... ] def */
/* */
/* or */
/* */
/* /sfnts [ */
/* <num_bin_bytes> RD <binary data> */
/* <num_bin_bytes> RD <binary data> */
/* ... */
/* ] def */
/* */
/* with exactly one space after the `RD' token. */
T1_Skip_Spaces( parser );
if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' )
{
FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
T1_Skip_Spaces( parser );
status = BEFORE_START;
string_size = 0;
old_string_size = 0;
count = 0;
while ( parser->root.cursor < limit )
{
cur = parser->root.cursor;
if ( *cur == ']' )
{
parser->root.cursor++;
goto Exit;
}
else if ( *cur == '<' )
{
T1_Skip_PS_Token( parser );
if ( parser->root.error )
goto Exit;
/* don't include delimiters */
string_size = (FT_Long)( ( parser->root.cursor - cur - 2 + 1 ) / 2 );
if ( FT_REALLOC( string_buf, old_string_size, string_size ) )
goto Fail;
allocated = 1;
parser->root.cursor = cur;
(void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 );
old_string_size = string_size;
string_size = real_size;
}
else if ( ft_isdigit( *cur ) )
{
if ( allocated )
{
FT_ERROR(( "t42_parse_sfnts: "
"can't handle mixed binary and hex strings\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
string_size = T1_ToInt( parser );
if ( string_size < 0 )
{
FT_ERROR(( "t42_parse_sfnts: invalid string size\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
T1_Skip_PS_Token( parser ); /* `RD' */
if ( parser->root.error )
return;
string_buf = parser->root.cursor + 1; /* one space after `RD' */
if ( limit - parser->root.cursor < string_size )
{
FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
else
parser->root.cursor += string_size + 1;
}
if ( !string_buf )
{
FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
/* A string can have a trailing zero (odd) byte for padding. */
/* Ignore it. */
if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 )
string_size--;
if ( !string_size )
{
FT_ERROR(( "t42_parse_sfnts: invalid string\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
for ( n = 0; n < string_size; n++ )
{
switch ( status )
{
case BEFORE_START:
/* load offset table, 12 bytes */
if ( count < 12 )
{
face->ttf_data[count++] = string_buf[n];
continue;
}
else
{
num_tables = 16 * face->ttf_data[4] + face->ttf_data[5];
status = BEFORE_TABLE_DIR;
face->ttf_size = 12 + 16 * num_tables;
if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) )
goto Fail;
}
/* fall through */
case BEFORE_TABLE_DIR:
/* the offset table is read; read the table directory */
if ( count < face->ttf_size )
{
face->ttf_data[count++] = string_buf[n];
continue;
}
else
{
int i;
FT_ULong len;
for ( i = 0; i < num_tables; i++ )
{
FT_Byte* p = face->ttf_data + 12 + 16 * i + 12;
len = FT_PEEK_ULONG( p );
/* Pad to a 4-byte boundary length */
face->ttf_size += ( len + 3 ) & ~3;
}
status = OTHER_TABLES;
/* there are no more than 256 tables, so no size check here */
if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
face->ttf_size + 1 ) )
goto Fail;
}
/* fall through */
case OTHER_TABLES:
/* all other tables are just copied */
if ( count >= face->ttf_size )
{
FT_ERROR(( "t42_parse_sfnts: too much binary data\n" ));
error = FT_THROW( Invalid_File_Format );
goto Fail;
}
face->ttf_data[count++] = string_buf[n];
}
}
T1_Skip_Spaces( parser );
}
/* if control reaches this point, the format was not valid */
error = FT_THROW( Invalid_File_Format );
Fail:
parser->root.error = error;
Exit:
if ( allocated )
FT_FREE( string_buf );
}
| 2,186 |
52,276 | 0 | static int compat_calc_entry(const struct ipt_entry *e,
const struct xt_table_info *info,
const void *base, struct xt_table_info *newinfo)
{
const struct xt_entry_match *ematch;
const struct xt_entry_target *t;
unsigned int entry_offset;
int off, i, ret;
off = sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
entry_offset = (void *)e - base;
xt_ematch_foreach(ematch, e)
off += xt_compat_match_offset(ematch->u.kernel.match);
t = ipt_get_target_c(e);
off += xt_compat_target_offset(t->u.kernel.target);
newinfo->size -= off;
ret = xt_compat_add_offset(AF_INET, entry_offset, off);
if (ret)
return ret;
for (i = 0; i < NF_INET_NUMHOOKS; i++) {
if (info->hook_entry[i] &&
(e < (struct ipt_entry *)(base + info->hook_entry[i])))
newinfo->hook_entry[i] -= off;
if (info->underflow[i] &&
(e < (struct ipt_entry *)(base + info->underflow[i])))
newinfo->underflow[i] -= off;
}
return 0;
}
| 2,187 |
55,855 | 0 | void console_sysfs_notify(void)
{
if (consdev)
sysfs_notify(&consdev->kobj, NULL, "active");
}
| 2,188 |
69,131 | 0 | ZEND_API zval* ZEND_FASTCALL _zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *pData, uint32_t flag ZEND_FILE_LINE_DC)
{
return _zend_hash_add_or_update_i(ht, key, pData, flag ZEND_FILE_LINE_RELAY_CC);
}
| 2,189 |
142,970 | 0 | void HTMLMediaElement::setPlaybackRate(double rate,
ExceptionState& exception_state) {
BLINK_MEDIA_LOG << "setPlaybackRate(" << (void*)this << ", " << rate << ")";
if (GetLoadType() == WebMediaPlayer::kLoadTypeMediaStream)
return;
if (rate != 0.0 && (rate < kMinRate || rate > kMaxRate)) {
UseCounter::Count(GetDocument(),
WebFeature::kHTMLMediaElementMediaPlaybackRateOutOfRange);
exception_state.ThrowDOMException(
DOMExceptionCode::kNotSupportedError,
"The provided playback rate (" + String::Number(rate) +
") is not in the " + "supported playback range.");
return;
}
if (playback_rate_ != rate) {
playback_rate_ = rate;
ScheduleEvent(event_type_names::kRatechange);
}
UpdatePlaybackRate();
}
| 2,190 |
143,182 | 0 | void Document::enforceInsecureRequestPolicy(WebInsecureRequestPolicy policy)
{
setInsecureRequestPolicy(getInsecureRequestPolicy() | policy);
if (frame())
frame()->loader().client()->didEnforceInsecureRequestPolicy(getInsecureRequestPolicy());
}
| 2,191 |
130,739 | 0 | static void enabledAtRuntimeMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectV8Internal::enabledAtRuntimeMethodMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 2,192 |
146,799 | 0 | void Document::NodeWillBeRemoved(Node& n) {
for (NodeIterator* ni : node_iterators_)
ni->NodeWillBeRemoved(n);
for (Range* range : ranges_)
range->NodeWillBeRemoved(n);
NotifyNodeWillBeRemoved(n);
if (ContainsV1ShadowTree())
n.CheckSlotChangeBeforeRemoved();
if (n.InActiveDocument() && n.IsElementNode())
GetStyleEngine().ElementWillBeRemoved(ToElement(n));
}
| 2,193 |
155,599 | 0 | const gfx::VectorIcon& AuthenticatorBleActivateSheetModel::GetStepIllustration(
ImageColorScheme color_scheme) const {
return color_scheme == ImageColorScheme::kDark ? kWebauthnBleTapDarkIcon
: kWebauthnBleTapIcon;
}
| 2,194 |
4,840 | 0 | GetSpriteCursor(DeviceIntPtr pDev)
{
return pDev->spriteInfo->sprite->current;
}
| 2,195 |
53,906 | 0 | ndp_find_msgrcv_handler_item(struct ndp *ndp,
ndp_msgrcv_handler_func_t func,
enum ndp_msg_type msg_type, uint32_t ifindex,
void *priv)
{
struct ndp_msgrcv_handler_item *handler_item;
list_for_each_node_entry(handler_item, &ndp->msgrcv_handler_list, list)
if (handler_item->func == func &&
handler_item->msg_type == msg_type &&
handler_item->ifindex == ifindex &&
handler_item->priv == priv)
return handler_item;
return NULL;
}
| 2,196 |
118,779 | 0 | void ContainerNode::setHovered(bool over)
{
if (over == hovered()) return;
Node::setHovered(over);
if (!renderer()) {
if (!over)
setNeedsStyleRecalc();
return;
}
if (renderer()) {
if (renderStyle()->affectedByHover() || (isElementNode() && toElement(this)->childrenAffectedByHover()))
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
RenderTheme::theme().stateChanged(renderer(), HoverState);
}
}
| 2,197 |
134,789 | 0 | void EventReaderLibevdevCros::OnLogMessage(void* data,
int level,
const char* fmt,
...) {
va_list args;
va_start(args, fmt);
if (level >= LOGLEVEL_ERROR)
LOG(ERROR) << "libevdev: " << FormatLog(fmt, args);
else if (level >= LOGLEVEL_WARNING)
LOG(WARNING) << "libevdev: " << FormatLog(fmt, args);
else
VLOG(3) << "libevdev: " << FormatLog(fmt, args);
va_end(args);
}
| 2,198 |
178,988 | 1 | asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
unsigned long address)
{
struct vm_area_struct *vma;
struct task_struct *tsk = current;
struct mm_struct *mm = tsk->mm;
unsigned int fixup;
unsigned long g2;
int from_user = !(regs->psr & PSR_PS);
int fault, code;
if(text_fault)
address = regs->pc;
/*
* We fault-in kernel-space virtual memory on-demand. The
* 'reference' page table is init_mm.pgd.
*
* NOTE! We MUST NOT take any locks for this case. We may
* be in an interrupt or a critical region, and should
* only copy the information from the master page table,
* nothing more.
*/
code = SEGV_MAPERR;
if (!ARCH_SUN4C && address >= TASK_SIZE)
goto vmalloc_fault;
/*
* If we're in an interrupt or have no user
* context, we must not take the fault..
*/
if (in_atomic() || !mm)
goto no_context;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
down_read(&mm->mmap_sem);
/*
* The kernel referencing a bad kernel pointer can lock up
* a sun4c machine completely, so we must attempt recovery.
*/
if(!from_user && address >= PAGE_OFFSET)
goto bad_area;
vma = find_vma(mm, address);
if(!vma)
goto bad_area;
if(vma->vm_start <= address)
goto good_area;
if(!(vma->vm_flags & VM_GROWSDOWN))
goto bad_area;
if(expand_stack(vma, address))
goto bad_area;
/*
* Ok, we have a good vm_area for this memory access, so
* we can handle it..
*/
good_area:
code = SEGV_ACCERR;
if(write) {
if(!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
/* Allow reads even for write-only mappings */
if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
}
/*
* If for any reason at all we couldn't handle the fault,
* make sure we exit gracefully rather than endlessly redo
* the fault.
*/
fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
goto out_of_memory;
else if (fault & VM_FAULT_SIGBUS)
goto do_sigbus;
BUG();
}
if (fault & VM_FAULT_MAJOR) {
current->maj_flt++;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
regs, address);
} else {
current->min_flt++;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
regs, address);
}
up_read(&mm->mmap_sem);
return;
/*
* Something tried to access memory that isn't in our memory map..
* Fix it, but check if it's kernel or user first..
*/
bad_area:
up_read(&mm->mmap_sem);
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (from_user) {
do_fault_siginfo(code, SIGSEGV, regs, text_fault);
return;
}
/* Is this in ex_table? */
no_context:
g2 = regs->u_regs[UREG_G2];
if (!from_user) {
fixup = search_extables_range(regs->pc, &g2);
if (fixup > 10) { /* Values below are reserved for other things */
extern const unsigned __memset_start[];
extern const unsigned __memset_end[];
extern const unsigned __csum_partial_copy_start[];
extern const unsigned __csum_partial_copy_end[];
#ifdef DEBUG_EXCEPTIONS
printk("Exception: PC<%08lx> faddr<%08lx>\n", regs->pc, address);
printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n",
regs->pc, fixup, g2);
#endif
if ((regs->pc >= (unsigned long)__memset_start &&
regs->pc < (unsigned long)__memset_end) ||
(regs->pc >= (unsigned long)__csum_partial_copy_start &&
regs->pc < (unsigned long)__csum_partial_copy_end)) {
regs->u_regs[UREG_I4] = address;
regs->u_regs[UREG_I5] = regs->pc;
}
regs->u_regs[UREG_G2] = g2;
regs->pc = fixup;
regs->npc = regs->pc + 4;
return;
}
}
unhandled_fault (address, tsk, regs);
do_exit(SIGKILL);
/*
* We ran out of memory, or some other thing happened to us that made
* us unable to handle the page fault gracefully.
*/
out_of_memory:
up_read(&mm->mmap_sem);
if (from_user) {
pagefault_out_of_memory();
return;
}
goto no_context;
do_sigbus:
up_read(&mm->mmap_sem);
do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);
if (!from_user)
goto no_context;
vmalloc_fault:
{
/*
* Synchronize this task's top level page-table
* with the 'reference' page table.
*/
int offset = pgd_index(address);
pgd_t *pgd, *pgd_k;
pmd_t *pmd, *pmd_k;
pgd = tsk->active_mm->pgd + offset;
pgd_k = init_mm.pgd + offset;
if (!pgd_present(*pgd)) {
if (!pgd_present(*pgd_k))
goto bad_area_nosemaphore;
pgd_val(*pgd) = pgd_val(*pgd_k);
return;
}
pmd = pmd_offset(pgd, address);
pmd_k = pmd_offset(pgd_k, address);
if (pmd_present(*pmd) || !pmd_present(*pmd_k))
goto bad_area_nosemaphore;
*pmd = *pmd_k;
return;
}
}
| 2,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.