unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
76,238
0
static int cdrom_ioctl_multisession(struct cdrom_device_info *cdi, void __user *argp) { struct cdrom_multisession ms_info; u8 requested_format; int ret; cd_dbg(CD_DO_IOCTL, "entering CDROMMULTISESSION\n"); if (!(cdi->ops->capability & CDC_MULTI_SESSION)) return -ENOSYS; if (copy_from_user(&ms_info, argp, sizeof(ms_info))) return -EFAULT; requested_format = ms_info.addr_format; if (requested_format != CDROM_MSF && requested_format != CDROM_LBA) return -EINVAL; ms_info.addr_format = CDROM_LBA; ret = cdi->ops->get_last_session(cdi, &ms_info); if (ret) return ret; sanitize_format(&ms_info.addr, &ms_info.addr_format, requested_format); if (copy_to_user(argp, &ms_info, sizeof(ms_info))) return -EFAULT; cd_dbg(CD_DO_IOCTL, "CDROMMULTISESSION successful\n"); return 0; }
2,800
137,581
0
bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const { return true; }
2,801
151,927
0
void RenderFrameHostImpl::DispatchBeforeUnload(BeforeUnloadType type, bool is_reload) { bool for_navigation = type == BeforeUnloadType::BROWSER_INITIATED_NAVIGATION || type == BeforeUnloadType::RENDERER_INITIATED_NAVIGATION; bool for_inner_delegate_attach = type == BeforeUnloadType::INNER_DELEGATE_ATTACH; DCHECK(for_navigation || for_inner_delegate_attach || !is_reload); DCHECK(type == BeforeUnloadType::BROWSER_INITIATED_NAVIGATION || type == BeforeUnloadType::RENDERER_INITIATED_NAVIGATION || type == BeforeUnloadType::INNER_DELEGATE_ATTACH || frame_tree_node_->IsMainFrame()); if (!for_navigation) { if (frame_tree_node_->navigation_request() && frame_tree_node_->navigation_request()->navigation_handle()) { frame_tree_node_->navigation_request() ->navigation_handle() ->set_net_error_code(net::ERR_ABORTED); } frame_tree_node_->ResetNavigationRequest(false, true); } bool check_subframes_only = type == BeforeUnloadType::RENDERER_INITIATED_NAVIGATION; if (!ShouldDispatchBeforeUnload(check_subframes_only)) { DCHECK(!for_navigation); base::OnceClosure task = base::BindOnce( [](base::WeakPtr<RenderFrameHostImpl> self) { if (!self) return; self->frame_tree_node_->render_manager()->OnBeforeUnloadACK( true, base::TimeTicks::Now()); }, weak_ptr_factory_.GetWeakPtr()); base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, std::move(task)); return; } TRACE_EVENT_ASYNC_BEGIN1("navigation", "RenderFrameHostImpl BeforeUnload", this, "&RenderFrameHostImpl", (void*)this); if (is_waiting_for_beforeunload_ack_) { unload_ack_is_for_navigation_ = unload_ack_is_for_navigation_ && for_navigation; } else { is_waiting_for_beforeunload_ack_ = true; beforeunload_dialog_request_cancels_unload_ = false; unload_ack_is_for_navigation_ = for_navigation; send_before_unload_start_time_ = base::TimeTicks::Now(); if (render_view_host_->GetDelegate()->IsJavaScriptDialogShowing()) { SimulateBeforeUnloadAck(type != BeforeUnloadType::DISCARD); } else { if (beforeunload_timeout_) beforeunload_timeout_->Start(beforeunload_timeout_delay_); beforeunload_pending_replies_.clear(); beforeunload_dialog_request_cancels_unload_ = (type == BeforeUnloadType::DISCARD); CheckOrDispatchBeforeUnloadForSubtree(check_subframes_only, true /* send_ipc */, is_reload); } } }
2,802
128,752
0
void ReadableStream::closeInternal() { ASSERT(m_state == Readable); m_state = Closed; resolveAllPendingReadsAsDone(); clearQueue(); if (m_reader) m_reader->close(); }
2,803
119,951
0
void ReverbConvolverStage::process(const float* source, size_t framesToProcess) { ASSERT(source); if (!source) return; const float* preDelayedSource; float* preDelayedDestination; float* temporaryBuffer; bool isTemporaryBufferSafe = false; if (m_preDelayLength > 0) { bool isPreDelaySafe = m_preReadWriteIndex + framesToProcess <= m_preDelayBuffer.size(); ASSERT(isPreDelaySafe); if (!isPreDelaySafe) return; isTemporaryBufferSafe = framesToProcess <= m_temporaryBuffer.size(); preDelayedDestination = m_preDelayBuffer.data() + m_preReadWriteIndex; preDelayedSource = preDelayedDestination; temporaryBuffer = m_temporaryBuffer.data(); } else { preDelayedDestination = 0; preDelayedSource = source; temporaryBuffer = m_preDelayBuffer.data(); isTemporaryBufferSafe = framesToProcess <= m_preDelayBuffer.size(); } ASSERT(isTemporaryBufferSafe); if (!isTemporaryBufferSafe) return; if (m_framesProcessed < m_preDelayLength) { m_accumulationBuffer->updateReadIndex(&m_accumulationReadIndex, framesToProcess); } else { if (!m_directMode) m_fftConvolver->process(m_fftKernel.get(), preDelayedSource, temporaryBuffer, framesToProcess); else m_directConvolver->process(m_directKernel.get(), preDelayedSource, temporaryBuffer, framesToProcess); m_accumulationBuffer->accumulate(temporaryBuffer, framesToProcess, &m_accumulationReadIndex, m_postDelayLength); } if (m_preDelayLength > 0) { memcpy(preDelayedDestination, source, sizeof(float) * framesToProcess); m_preReadWriteIndex += framesToProcess; ASSERT(m_preReadWriteIndex <= m_preDelayLength); if (m_preReadWriteIndex >= m_preDelayLength) m_preReadWriteIndex = 0; } m_framesProcessed += framesToProcess; }
2,804
159,468
0
WebGLImageConversion::DataFormat GetDataFormat(GLenum destination_format, GLenum destination_type) { WebGLImageConversion::DataFormat dst_format = WebGLImageConversion::kDataFormatRGBA8; switch (destination_type) { case GL_BYTE: switch (destination_format) { case GL_RED: case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR8_S; break; case GL_RG: case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG8_S; break; case GL_RGB: case GL_RGB_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGB8_S; break; case GL_RGBA: case GL_RGBA_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGBA8_S; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_UNSIGNED_BYTE: switch (destination_format) { case GL_RGB: case GL_RGB_INTEGER: case GL_SRGB_EXT: dst_format = WebGLImageConversion::kDataFormatRGB8; break; case GL_RGBA: case GL_RGBA_INTEGER: case GL_SRGB_ALPHA_EXT: dst_format = WebGLImageConversion::kDataFormatRGBA8; break; case GL_ALPHA: dst_format = WebGLImageConversion::kDataFormatA8; break; case GL_LUMINANCE: case GL_RED: case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR8; break; case GL_RG: case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG8; break; case GL_LUMINANCE_ALPHA: dst_format = WebGLImageConversion::kDataFormatRA8; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_SHORT: switch (destination_format) { case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR16_S; break; case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG16_S; break; case GL_RGB_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGB16_S; case GL_RGBA_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGBA16_S; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_UNSIGNED_SHORT: switch (destination_format) { case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR16; break; case GL_DEPTH_COMPONENT: dst_format = WebGLImageConversion::kDataFormatD16; break; case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG16; break; case GL_RGB_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGB16; break; case GL_RGBA_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGBA16; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_INT: switch (destination_format) { case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR32_S; break; case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG32_S; break; case GL_RGB_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGB32_S; break; case GL_RGBA_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGBA32_S; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_UNSIGNED_INT: switch (destination_format) { case GL_RED_INTEGER: dst_format = WebGLImageConversion::kDataFormatR32; break; case GL_DEPTH_COMPONENT: dst_format = WebGLImageConversion::kDataFormatD32; break; case GL_RG_INTEGER: dst_format = WebGLImageConversion::kDataFormatRG32; break; case GL_RGB_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGB32; break; case GL_RGBA_INTEGER: dst_format = WebGLImageConversion::kDataFormatRGBA32; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_HALF_FLOAT_OES: // OES_texture_half_float case GL_HALF_FLOAT: switch (destination_format) { case GL_RGBA: dst_format = WebGLImageConversion::kDataFormatRGBA16F; break; case GL_RGB: dst_format = WebGLImageConversion::kDataFormatRGB16F; break; case GL_RG: dst_format = WebGLImageConversion::kDataFormatRG16F; break; case GL_ALPHA: dst_format = WebGLImageConversion::kDataFormatA16F; break; case GL_LUMINANCE: case GL_RED: dst_format = WebGLImageConversion::kDataFormatR16F; break; case GL_LUMINANCE_ALPHA: dst_format = WebGLImageConversion::kDataFormatRA16F; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_FLOAT: // OES_texture_float switch (destination_format) { case GL_RGBA: dst_format = WebGLImageConversion::kDataFormatRGBA32F; break; case GL_RGB: dst_format = WebGLImageConversion::kDataFormatRGB32F; break; case GL_RG: dst_format = WebGLImageConversion::kDataFormatRG32F; break; case GL_ALPHA: dst_format = WebGLImageConversion::kDataFormatA32F; break; case GL_LUMINANCE: case GL_RED: dst_format = WebGLImageConversion::kDataFormatR32F; break; case GL_DEPTH_COMPONENT: dst_format = WebGLImageConversion::kDataFormatD32F; break; case GL_LUMINANCE_ALPHA: dst_format = WebGLImageConversion::kDataFormatRA32F; break; default: return WebGLImageConversion::kDataFormatNumFormats; } break; case GL_UNSIGNED_SHORT_4_4_4_4: dst_format = WebGLImageConversion::kDataFormatRGBA4444; break; case GL_UNSIGNED_SHORT_5_5_5_1: dst_format = WebGLImageConversion::kDataFormatRGBA5551; break; case GL_UNSIGNED_SHORT_5_6_5: dst_format = WebGLImageConversion::kDataFormatRGB565; break; case GL_UNSIGNED_INT_5_9_9_9_REV: dst_format = WebGLImageConversion::kDataFormatRGB5999; break; case GL_UNSIGNED_INT_24_8: dst_format = WebGLImageConversion::kDataFormatDS24_8; break; case GL_UNSIGNED_INT_10F_11F_11F_REV: dst_format = WebGLImageConversion::kDataFormatRGB10F11F11F; break; case GL_UNSIGNED_INT_2_10_10_10_REV: dst_format = WebGLImageConversion::kDataFormatRGBA2_10_10_10; break; default: return WebGLImageConversion::kDataFormatNumFormats; } return dst_format; }
2,805
30,098
0
wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ) { int error; error = wait_event_freezekillable(server->response_q, midQ->mid_state != MID_REQUEST_SUBMITTED); if (error < 0) return -ERESTARTSYS; return 0; }
2,806
154,469
0
GLES2DecoderPassthroughImpl::GetTranslator(GLenum type) { return nullptr; }
2,807
60,455
0
static inline int save_fsave_header(struct task_struct *tsk, void __user *buf) { if (use_fxsr()) { struct xregs_state *xsave = &tsk->thread.fpu.state.xsave; struct user_i387_ia32_struct env; struct _fpstate_32 __user *fp = buf; convert_from_fxsr(&env, tsk); if (__copy_to_user(buf, &env, sizeof(env)) || __put_user(xsave->i387.swd, &fp->status) || __put_user(X86_FXSR_MAGIC, &fp->magic)) return -1; } else { struct fregs_state __user *fp = buf; u32 swd; if (__get_user(swd, &fp->swd) || __put_user(swd, &fp->status)) return -1; } return 0; }
2,808
46,723
0
static int sha384_init(struct shash_desc *desc) { struct s390_sha_ctx *ctx = shash_desc_ctx(desc); *(__u64 *)&ctx->state[0] = 0xcbbb9d5dc1059ed8ULL; *(__u64 *)&ctx->state[2] = 0x629a292a367cd507ULL; *(__u64 *)&ctx->state[4] = 0x9159015a3070dd17ULL; *(__u64 *)&ctx->state[6] = 0x152fecd8f70e5939ULL; *(__u64 *)&ctx->state[8] = 0x67332667ffc00b31ULL; *(__u64 *)&ctx->state[10] = 0x8eb44a8768581511ULL; *(__u64 *)&ctx->state[12] = 0xdb0c2e0d64f98fa7ULL; *(__u64 *)&ctx->state[14] = 0x47b5481dbefa4fa4ULL; ctx->count = 0; ctx->func = KIMD_SHA_512; return 0; }
2,809
24,537
0
static void b43_dma_tx_suspend_ring(struct b43_dmaring *ring) { B43_WARN_ON(!ring->tx); ring->ops->tx_suspend(ring); }
2,810
14,804
0
ftp_quit(ftpbuf_t *ftp) { if (ftp == NULL) { return 0; } if (!ftp_putcmd(ftp, "QUIT", NULL)) { return 0; } if (!ftp_getresp(ftp) || ftp->resp != 221) { return 0; } if (ftp->pwd) { efree(ftp->pwd); ftp->pwd = NULL; } return 1; }
2,811
95,971
0
void CL_InitServerInfo( serverInfo_t *server, netadr_t *address ) { server->adr = *address; server->clients = 0; server->hostName[0] = '\0'; server->mapName[0] = '\0'; server->maxClients = 0; server->maxPing = 0; server->minPing = 0; server->ping = -1; server->game[0] = '\0'; server->gameType = 0; server->netType = 0; server->punkbuster = 0; server->g_humanplayers = 0; server->g_needpass = 0; }
2,812
104,904
0
void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader, const char* data, int data_length, int encoded_data_length) { bytes_received_ += data_length; buffer_.insert(buffer_.end(), data, data + data_length); if (user_buffer_) { RunCallback(FillUserBuffer()); } else { DCHECK(!pending_callback_.get() || pending_callback_->completed()); } DCHECK(!request_info_ || (request_info_->prefetch_buffer_lower_threshold() < request_info_->prefetch_buffer_upper_threshold())); if (!is_streaming_to_file_ && !is_asynchronous_load_suspended_ && request_info_ && (buffer_.size() >= static_cast<size_t>( request_info_->prefetch_buffer_upper_threshold()))) { DVLOG(1) << "Suspending async load - buffer size: " << buffer_.size(); loader->setDefersLoading(true); is_asynchronous_load_suspended_ = true; } }
2,813
60,269
0
static int proc_key_users_open(struct inode *inode, struct file *file) { return seq_open(file, &proc_key_users_ops); }
2,814
144,125
0
png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; #endif png_debug(1, "in png_write_IDAT"); /* Optimize the CMF field in the zlib stream. */ /* This hack of the zlib stream is compliant to the stream specification. */ if (!(png_ptr->mode & PNG_HAVE_IDAT) && png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) { unsigned int z_cmf = data[0]; /* zlib compression method and flags */ if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) { /* Avoid memory underflows and multiplication overflows. * * The conditions below are practically always satisfied; * however, they still must be checked. */ if (length >= 2 && png_ptr->height < 16384 && png_ptr->width < 16384) { png_uint_32 uncompressed_idat_size = png_ptr->height * ((png_ptr->width * png_ptr->channels * png_ptr->bit_depth + 15) >> 3); unsigned int z_cinfo = z_cmf >> 4; unsigned int half_z_window_size = 1 << (z_cinfo + 7); while (uncompressed_idat_size <= half_z_window_size && half_z_window_size >= 256) { z_cinfo--; half_z_window_size >>= 1; } z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); if (data[0] != (png_byte)z_cmf) { data[0] = (png_byte)z_cmf; data[1] &= 0xe0; data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f); } } } else png_error(png_ptr, "Invalid zlib compression method or flags in IDAT"); } png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); png_ptr->mode |= PNG_HAVE_IDAT; }
2,815
60,766
0
sg_poll(struct file *filp, poll_table * wait) { unsigned int res = 0; Sg_device *sdp; Sg_fd *sfp; Sg_request *srp; int count = 0; unsigned long iflags; sfp = filp->private_data; if (!sfp) return POLLERR; sdp = sfp->parentdp; if (!sdp) return POLLERR; poll_wait(filp, &sfp->read_wait, wait); read_lock_irqsave(&sfp->rq_list_lock, iflags); list_for_each_entry(srp, &sfp->rq_list, entry) { /* if any read waiting, flag it */ if ((0 == res) && (1 == srp->done) && (!srp->sg_io_owned)) res = POLLIN | POLLRDNORM; ++count; } read_unlock_irqrestore(&sfp->rq_list_lock, iflags); if (atomic_read(&sdp->detaching)) res |= POLLHUP; else if (!sfp->cmd_q) { if (0 == count) res |= POLLOUT | POLLWRNORM; } else if (count < SG_MAX_QUEUE) res |= POLLOUT | POLLWRNORM; SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, "sg_poll: res=0x%x\n", (int) res)); return res; }
2,816
164,408
0
URLPatternSet PermissionsData::GetEffectiveHostPermissions() const { base::AutoLock auto_lock(runtime_lock_); URLPatternSet effective_hosts = active_permissions_unsafe_->effective_hosts(); for (const auto& val : tab_specific_permissions_) effective_hosts.AddPatterns(val.second->effective_hosts()); return effective_hosts; }
2,817
179,638
1
static int complete_emulated_mmio(struct kvm_vcpu *vcpu) { struct kvm_run *run = vcpu->run; struct kvm_mmio_fragment *frag; unsigned len; BUG_ON(!vcpu->mmio_needed); /* Complete previous fragment */ frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment]; len = min(8u, frag->len); if (!vcpu->mmio_is_write) memcpy(frag->data, run->mmio.data, len); if (frag->len <= 8) { /* Switch to the next fragment. */ frag++; vcpu->mmio_cur_fragment++; } else { /* Go forward to the next mmio piece. */ frag->data += len; frag->gpa += len; frag->len -= len; } if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { vcpu->mmio_needed = 0; /* FIXME: return into emulator if single-stepping. */ if (vcpu->mmio_is_write) return 1; vcpu->mmio_read_completed = 1; return complete_emulated_io(vcpu); } run->exit_reason = KVM_EXIT_MMIO; run->mmio.phys_addr = frag->gpa; if (vcpu->mmio_is_write) memcpy(run->mmio.data, frag->data, min(8u, frag->len)); run->mmio.len = min(8u, frag->len); run->mmio.is_write = vcpu->mmio_is_write; vcpu->arch.complete_userspace_io = complete_emulated_mmio; return 0; }
2,818
175,193
0
SYSCALL_DEFINE1(getsid, pid_t, pid) { struct task_struct *p; struct pid *sid; int retval; rcu_read_lock(); if (!pid) sid = task_session(current); else { retval = -ESRCH; p = find_task_by_vpid(pid); if (!p) goto out; sid = task_session(p); if (!sid) goto out; retval = security_task_getsid(p); if (retval) goto out; } retval = pid_vnr(sid); out: rcu_read_unlock(); return retval; }
2,819
88,933
0
MagickExport MagickBooleanType GetImageEntropy(const Image *image, double *entropy,ExceptionInfo *exception) { MagickBooleanType status; status=GetImageChannelEntropy(image,CompositeChannels,entropy,exception); return(status); }
2,820
148,477
0
void WebContentsImpl::OnEnumerateDirectory(RenderViewHostImpl* source, int request_id, const base::FilePath& path) { if (!delegate_) return; ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->CanReadFile(source->GetProcess()->GetID(), path)) { delegate_->EnumerateDirectory(this, request_id, path); } }
2,821
177,019
0
void InputDispatcher::traceInboundQueueLengthLocked() { if (ATRACE_ENABLED()) { ATRACE_INT("iq", mInboundQueue.count()); } }
2,822
67,146
0
int nfsd_pool_stats_release(struct inode *inode, struct file *file) { int ret = seq_release(inode, file); struct net *net = inode->i_sb->s_fs_info; mutex_lock(&nfsd_mutex); /* this function really, really should have been called svc_put() */ nfsd_destroy(net); mutex_unlock(&nfsd_mutex); return ret; }
2,823
142,577
0
FocusCycler* focus_cycler() { return focus_cycler_; }
2,824
36,970
0
file_tryelf(struct magic_set *ms, int fd, const unsigned char *buf, size_t nbytes) { union { int32_t l; char c[sizeof (int32_t)]; } u; int clazz; int swap; struct stat st; off_t fsize; int flags = 0; Elf32_Ehdr elf32hdr; Elf64_Ehdr elf64hdr; uint16_t type; if (ms->flags & (MAGIC_MIME|MAGIC_APPLE)) return 0; /* * ELF executables have multiple section headers in arbitrary * file locations and thus file(1) cannot determine it from easily. * Instead we traverse thru all section headers until a symbol table * one is found or else the binary is stripped. * Return immediately if it's not ELF (so we avoid pipe2file unless needed). */ if (buf[EI_MAG0] != ELFMAG0 || (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1) || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3) return 0; /* * If we cannot seek, it must be a pipe, socket or fifo. */ if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE)) fd = file_pipe2file(ms, fd, buf, nbytes); if (fstat(fd, &st) == -1) { file_badread(ms); return -1; } fsize = st.st_size; clazz = buf[EI_CLASS]; switch (clazz) { case ELFCLASS32: #undef elf_getu #define elf_getu(a, b) elf_getu32(a, b) #undef elfhdr #define elfhdr elf32hdr #include "elfclass.h" case ELFCLASS64: #undef elf_getu #define elf_getu(a, b) elf_getu64(a, b) #undef elfhdr #define elfhdr elf64hdr #include "elfclass.h" default: if (file_printf(ms, ", unknown class %d", clazz) == -1) return -1; break; } return 0; }
2,825
46,798
0
static int sha256_sparc64_export(struct shash_desc *desc, void *out) { struct sha256_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; }
2,826
165,008
0
inline HTMLCanvasElement::HTMLCanvasElement(Document& document) : HTMLElement(kCanvasTag, document), ContextLifecycleObserver(&document), PageVisibilityObserver(document.GetPage()), size_(kDefaultCanvasWidth, kDefaultCanvasHeight), context_creation_was_blocked_(false), ignore_reset_(false), origin_clean_(true), surface_layer_bridge_(nullptr), gpu_memory_usage_(0), externally_allocated_memory_(0), gpu_readback_invoked_in_current_frame_(false), gpu_readback_successive_frames_(0) { UseCounter::Count(document, WebFeature::kHTMLCanvasElement); GetDocument().IncrementNumberOfCanvases(); }
2,827
100,095
0
GURL SimplifyUrlForRequest(const GURL& url) { DCHECK(url.is_valid()); GURL::Replacements replacements; replacements.ClearUsername(); replacements.ClearPassword(); replacements.ClearRef(); return url.ReplaceComponents(replacements); }
2,828
139,387
0
static bool EnabledInRichlyEditableText(LocalFrame& frame, Event*, EditorCommandSource source) { frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && !frame.Selection().SelectionHasFocus()) return false; return !frame.Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsNone() && frame.Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsContentRichlyEditable() && frame.Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .RootEditableElement(); }
2,829
102,452
0
void LayerTreeCoordinator::attachLayer(CoordinatedGraphicsLayer* layer) { ASSERT(!m_registeredLayers.contains(layer)); m_registeredLayers.add(layer); layer->setContentsScale(m_contentsScale); layer->adjustVisibleRect(); }
2,830
52,363
0
static int __net_init ip6_tables_net_init(struct net *net) { return xt_proto_init(net, NFPROTO_IPV6); }
2,831
104,206
0
RenderbufferManager* renderbuffer_manager() { return group_->renderbuffer_manager(); }
2,832
184,742
1
bool BaseSessionService::RestoreUpdateTabNavigationCommand( const SessionCommand& command, TabNavigation* navigation, SessionID::id_type* tab_id) { scoped_ptr<Pickle> pickle(command.PayloadAsPickle()); if (!pickle.get()) return false; void* iterator = NULL; std::string url_spec; if (!pickle->ReadInt(&iterator, tab_id) || !pickle->ReadInt(&iterator, &(navigation->index_)) || !pickle->ReadString(&iterator, &url_spec) || !pickle->ReadString16(&iterator, &(navigation->title_)) || !pickle->ReadString(&iterator, &(navigation->state_)) || !pickle->ReadInt(&iterator, reinterpret_cast<int*>(&(navigation->transition_)))) return false; bool has_type_mask = pickle->ReadInt(&iterator, &(navigation->type_mask_)); if (has_type_mask) { std::string referrer_spec; pickle->ReadString(&iterator, &referrer_spec); int policy_int; WebReferrerPolicy policy; if (pickle->ReadInt(&iterator, &policy_int)) policy = static_cast<WebReferrerPolicy>(policy_int); else policy = WebKit::WebReferrerPolicyDefault; navigation->referrer_ = content::Referrer( referrer_spec.empty() ? GURL() : GURL(referrer_spec), policy); std::string content_state; if (CompressDataHelper::ReadAndDecompressStringFromPickle( *pickle.get(), &iterator, &content_state) && !content_state.empty()) { navigation->state_ = content_state; } } navigation->virtual_url_ = GURL(url_spec); return true; }
2,833
96,750
0
static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { #define WriteRunlengthPacket(image,pixel,length,p) \ { \ if ((image->alpha_trait != UndefinedPixelTrait) && (length != 0) && \ (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha)) \ { \ q=PopHexPixel(hex_digits,0xff,q); \ q=PopHexPixel(hex_digits,0xff,q); \ q=PopHexPixel(hex_digits,0xff,q); \ } \ else \ { \ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.red)),q); \ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.green)),q); \ q=PopHexPixel(hex_digits,ScaleQuantumToChar(ClampToQuantum(pixel.blue)),q); \ } \ q=PopHexPixel(hex_digits,(size_t) MagickMin(length,0xff),q); \ } static const char hex_digits[][3] = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0A", "0B", "0C", "0D", "0E", "0F", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1A", "1B", "1C", "1D", "1E", "1F", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", "2F", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3A", "3B", "3C", "3D", "3E", "3F", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5A", "5B", "5C", "5D", "5E", "5F", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", "7B", "7C", "7D", "7E", "7F", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8A", "8B", "8C", "8D", "8E", "8F", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9A", "9B", "9C", "9D", "9E", "9F", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "AA", "AB", "AC", "AD", "AE", "AF", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "BA", "BB", "BC", "BD", "BE", "BF", "C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "CA", "CB", "CC", "CD", "CE", "CF", "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "DA", "DB", "DC", "DD", "DE", "DF", "E0", "E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8", "E9", "EA", "EB", "EC", "ED", "EE", "EF", "F0", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "FA", "FB", "FC", "FD", "FE", "FF" }, PostscriptProlog[] = "%%BeginProlog\n" "%\n" "% Display a color image. The image is displayed in color on\n" "% Postscript viewers or printers that support color, otherwise\n" "% it is displayed as grayscale.\n" "%\n" "/DirectClassPacket\n" "{\n" " %\n" " % Get a DirectClass packet.\n" " %\n" " % Parameters:\n" " % red.\n" " % green.\n" " % blue.\n" " % length: number of pixels minus one of this color (optional).\n" " %\n" " currentfile color_packet readhexstring pop pop\n" " compression 0 eq\n" " {\n" " /number_pixels 3 def\n" " }\n" " {\n" " currentfile byte readhexstring pop 0 get\n" " /number_pixels exch 1 add 3 mul def\n" " } ifelse\n" " 0 3 number_pixels 1 sub\n" " {\n" " pixels exch color_packet putinterval\n" " } for\n" " pixels 0 number_pixels getinterval\n" "} bind def\n" "\n" "/DirectClassImage\n" "{\n" " %\n" " % Display a DirectClass image.\n" " %\n" " systemdict /colorimage known\n" " {\n" " columns rows 8\n" " [\n" " columns 0 0\n" " rows neg 0 rows\n" " ]\n" " { DirectClassPacket } false 3 colorimage\n" " }\n" " {\n" " %\n" " % No colorimage operator; convert to grayscale.\n" " %\n" " columns rows 8\n" " [\n" " columns 0 0\n" " rows neg 0 rows\n" " ]\n" " { GrayDirectClassPacket } image\n" " } ifelse\n" "} bind def\n" "\n" "/GrayDirectClassPacket\n" "{\n" " %\n" " % Get a DirectClass packet; convert to grayscale.\n" " %\n" " % Parameters:\n" " % red\n" " % green\n" " % blue\n" " % length: number of pixels minus one of this color (optional).\n" " %\n" " currentfile color_packet readhexstring pop pop\n" " color_packet 0 get 0.299 mul\n" " color_packet 1 get 0.587 mul add\n" " color_packet 2 get 0.114 mul add\n" " cvi\n" " /gray_packet exch def\n" " compression 0 eq\n" " {\n" " /number_pixels 1 def\n" " }\n" " {\n" " currentfile byte readhexstring pop 0 get\n" " /number_pixels exch 1 add def\n" " } ifelse\n" " 0 1 number_pixels 1 sub\n" " {\n" " pixels exch gray_packet put\n" " } for\n" " pixels 0 number_pixels getinterval\n" "} bind def\n" "\n" "/GrayPseudoClassPacket\n" "{\n" " %\n" " % Get a PseudoClass packet; convert to grayscale.\n" " %\n" " % Parameters:\n" " % index: index into the colormap.\n" " % length: number of pixels minus one of this color (optional).\n" " %\n" " currentfile byte readhexstring pop 0 get\n" " /offset exch 3 mul def\n" " /color_packet colormap offset 3 getinterval def\n" " color_packet 0 get 0.299 mul\n" " color_packet 1 get 0.587 mul add\n" " color_packet 2 get 0.114 mul add\n" " cvi\n" " /gray_packet exch def\n" " compression 0 eq\n" " {\n" " /number_pixels 1 def\n" " }\n" " {\n" " currentfile byte readhexstring pop 0 get\n" " /number_pixels exch 1 add def\n" " } ifelse\n" " 0 1 number_pixels 1 sub\n" " {\n" " pixels exch gray_packet put\n" " } for\n" " pixels 0 number_pixels getinterval\n" "} bind def\n" "\n" "/PseudoClassPacket\n" "{\n" " %\n" " % Get a PseudoClass packet.\n" " %\n" " % Parameters:\n" " % index: index into the colormap.\n" " % length: number of pixels minus one of this color (optional).\n" " %\n" " currentfile byte readhexstring pop 0 get\n" " /offset exch 3 mul def\n" " /color_packet colormap offset 3 getinterval def\n" " compression 0 eq\n" " {\n" " /number_pixels 3 def\n" " }\n" " {\n" " currentfile byte readhexstring pop 0 get\n" " /number_pixels exch 1 add 3 mul def\n" " } ifelse\n" " 0 3 number_pixels 1 sub\n" " {\n" " pixels exch color_packet putinterval\n" " } for\n" " pixels 0 number_pixels getinterval\n" "} bind def\n" "\n" "/PseudoClassImage\n" "{\n" " %\n" " % Display a PseudoClass image.\n" " %\n" " % Parameters:\n" " % class: 0-PseudoClass or 1-Grayscale.\n" " %\n" " currentfile buffer readline pop\n" " token pop /class exch def pop\n" " class 0 gt\n" " {\n" " currentfile buffer readline pop\n" " token pop /depth exch def pop\n" " /grays columns 8 add depth sub depth mul 8 idiv string def\n" " columns rows depth\n" " [\n" " columns 0 0\n" " rows neg 0 rows\n" " ]\n" " { currentfile grays readhexstring pop } image\n" " }\n" " {\n" " %\n" " % Parameters:\n" " % colors: number of colors in the colormap.\n" " % colormap: red, green, blue color packets.\n" " %\n" " currentfile buffer readline pop\n" " token pop /colors exch def pop\n" " /colors colors 3 mul def\n" " /colormap colors string def\n" " currentfile colormap readhexstring pop pop\n" " systemdict /colorimage known\n" " {\n" " columns rows 8\n" " [\n" " columns 0 0\n" " rows neg 0 rows\n" " ]\n" " { PseudoClassPacket } false 3 colorimage\n" " }\n" " {\n" " %\n" " % No colorimage operator; convert to grayscale.\n" " %\n" " columns rows 8\n" " [\n" " columns 0 0\n" " rows neg 0 rows\n" " ]\n" " { GrayPseudoClassPacket } image\n" " } ifelse\n" " } ifelse\n" "} bind def\n" "\n" "/DisplayImage\n" "{\n" " %\n" " % Display a DirectClass or PseudoClass image.\n" " %\n" " % Parameters:\n" " % x & y translation.\n" " % x & y scale.\n" " % label pointsize.\n" " % image label.\n" " % image columns & rows.\n" " % class: 0-DirectClass or 1-PseudoClass.\n" " % compression: 0-none or 1-RunlengthEncoded.\n" " % hex color packets.\n" " %\n" " gsave\n" " /buffer 512 string def\n" " /byte 1 string def\n" " /color_packet 3 string def\n" " /pixels 768 string def\n" "\n" " currentfile buffer readline pop\n" " token pop /x exch def\n" " token pop /y exch def pop\n" " x y translate\n" " currentfile buffer readline pop\n" " token pop /x exch def\n" " token pop /y exch def pop\n" " currentfile buffer readline pop\n" " token pop /pointsize exch def pop\n", PostscriptEpilog[] = " x y scale\n" " currentfile buffer readline pop\n" " token pop /columns exch def\n" " token pop /rows exch def pop\n" " currentfile buffer readline pop\n" " token pop /class exch def pop\n" " currentfile buffer readline pop\n" " token pop /compression exch def pop\n" " class 0 gt { PseudoClassImage } { DirectClassImage } ifelse\n" " grestore\n"; char buffer[MagickPathExtent], date[MagickPathExtent], **labels, page_geometry[MagickPathExtent]; CompressionType compression; const char *value; const StringInfo *profile; double pointsize; GeometryInfo geometry_info; MagickBooleanType status; MagickOffsetType scene; MagickStatusType flags; PixelInfo pixel; PointInfo delta, resolution, scale; Quantum index; RectangleInfo geometry, media_info, page_info; register const Quantum *p; register ssize_t i, x; register unsigned char *q; SegmentInfo bounds; size_t bit, byte, imageListLength, length, page, text_size; ssize_t j, y; time_t timer; unsigned char pixels[2048]; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); (void) memset(&bounds,0,sizeof(bounds)); compression=image->compression; if (image_info->compression != UndefinedCompression) compression=image_info->compression; page=1; scene=0; imageListLength=GetImageListLength(image); do { /* Scale relative to dots-per-inch. */ (void) TransformImageColorspace(image,sRGBColorspace,exception); delta.x=DefaultResolution; delta.y=DefaultResolution; resolution.x=image->resolution.x; resolution.y=image->resolution.y; if ((resolution.x == 0.0) || (resolution.y == 0.0)) { flags=ParseGeometry(PSDensityGeometry,&geometry_info); resolution.x=geometry_info.rho; resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) resolution.y=resolution.x; } if (image_info->density != (char *) NULL) { flags=ParseGeometry(image_info->density,&geometry_info); resolution.x=geometry_info.rho; resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) resolution.y=resolution.x; } if (image->units == PixelsPerCentimeterResolution) { resolution.x=(double) ((size_t) (100.0*2.54*resolution.x+0.5)/100.0); resolution.y=(double) ((size_t) (100.0*2.54*resolution.y+0.5)/100.0); } SetGeometry(image,&geometry); (void) FormatLocaleString(page_geometry,MagickPathExtent,"%.20gx%.20g", (double) image->columns,(double) image->rows); if (image_info->page != (char *) NULL) (void) CopyMagickString(page_geometry,image_info->page,MagickPathExtent); else if ((image->page.width != 0) && (image->page.height != 0)) (void) FormatLocaleString(page_geometry,MagickPathExtent, "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double) image->page.height,(double) image->page.x,(double) image->page.y); else if ((image->gravity != UndefinedGravity) && (LocaleCompare(image_info->magick,"PS") == 0)) (void) CopyMagickString(page_geometry,PSPageGeometry, MagickPathExtent); (void) ConcatenateMagickString(page_geometry,">",MagickPathExtent); (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); scale.x=PerceptibleReciprocal(resolution.x)*geometry.width*delta.x; geometry.width=(size_t) floor(scale.x+0.5); scale.y=PerceptibleReciprocal(resolution.y)*geometry.height*delta.y; geometry.height=(size_t) floor(scale.y+0.5); (void) ParseAbsoluteGeometry(page_geometry,&media_info); (void) ParseGravityGeometry(image,page_geometry,&page_info,exception); if (image->gravity != UndefinedGravity) { geometry.x=(-page_info.x); geometry.y=(ssize_t) (media_info.height+page_info.y-image->rows); } pointsize=12.0; if (image_info->pointsize != 0.0) pointsize=image_info->pointsize; text_size=0; value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) text_size=(size_t) (MultilineCensus(value)*pointsize+12); if (page == 1) { /* Output Postscript header. */ if (LocaleCompare(image_info->magick,"PS") == 0) (void) CopyMagickString(buffer,"%!PS-Adobe-3.0\n",MagickPathExtent); else (void) CopyMagickString(buffer,"%!PS-Adobe-3.0 EPSF-3.0\n", MagickPathExtent); (void) WriteBlobString(image,buffer); (void) WriteBlobString(image,"%%Creator: (ImageMagick)\n"); (void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Title: (%s)\n", image->filename); (void) WriteBlobString(image,buffer); timer=GetMagickTime(); (void) FormatMagickTime(timer,MagickPathExtent,date); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%CreationDate: (%s)\n",date); (void) WriteBlobString(image,buffer); bounds.x1=(double) geometry.x; bounds.y1=(double) geometry.y; bounds.x2=(double) geometry.x+scale.x; bounds.y2=(double) geometry.y+(geometry.height+text_size); if ((image_info->adjoin != MagickFalse) && (GetNextImageInList(image) != (Image *) NULL)) (void) CopyMagickString(buffer,"%%%%BoundingBox: (atend)\n", MagickPathExtent); else { (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5), ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1, bounds.y1,bounds.x2,bounds.y2); } (void) WriteBlobString(image,buffer); profile=GetImageProfile(image,"8bim"); if (profile != (StringInfo *) NULL) { /* Embed Photoshop profile. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%%BeginPhotoshop: %.20g",(double) GetStringInfoLength(profile)); (void) WriteBlobString(image,buffer); for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++) { if ((i % 32) == 0) (void) WriteBlobString(image,"\n% "); (void) FormatLocaleString(buffer,MagickPathExtent,"%02X", (unsigned int) (GetStringInfoDatum(profile)[i] & 0xff)); (void) WriteBlobString(image,buffer); } (void) WriteBlobString(image,"\n%EndPhotoshop\n"); } profile=GetImageProfile(image,"xmp"); DisableMSCWarning(4127) if (0 && (profile != (StringInfo *) NULL)) RestoreMSCWarning { /* Embed XML profile. */ (void) WriteBlobString(image,"\n%begin_xml_code\n"); (void) FormatLocaleString(buffer,MagickPathExtent, "\n%%begin_xml_packet: %.20g\n",(double) GetStringInfoLength(profile)); (void) WriteBlobString(image,buffer); for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++) (void) WriteBlobByte(image,GetStringInfoDatum(profile)[i]); (void) WriteBlobString(image,"\n%end_xml_packet\n%end_xml_code\n"); } value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) (void) WriteBlobString(image, "%%DocumentNeededResources: font Times-Roman\n"); (void) WriteBlobString(image,"%%DocumentData: Clean7Bit\n"); (void) WriteBlobString(image,"%%LanguageLevel: 1\n"); if (LocaleCompare(image_info->magick,"PS") != 0) (void) WriteBlobString(image,"%%Pages: 1\n"); else { /* Compute the number of pages. */ (void) WriteBlobString(image,"%%Orientation: Portrait\n"); (void) WriteBlobString(image,"%%PageOrder: Ascend\n"); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%Pages: %.20g\n",image_info->adjoin != MagickFalse ? (double) imageListLength : 1.0); (void) WriteBlobString(image,buffer); } (void) WriteBlobString(image,"%%EndComments\n"); (void) WriteBlobString(image,"\n%%BeginDefaults\n"); (void) WriteBlobString(image,"%%EndDefaults\n\n"); if ((LocaleCompare(image_info->magick,"EPI") == 0) || (LocaleCompare(image_info->magick,"EPSI") == 0) || (LocaleCompare(image_info->magick,"EPT") == 0)) { Image *preview_image; Quantum pixel; register ssize_t x; ssize_t y; /* Create preview image. */ preview_image=CloneImage(image,0,0,MagickTrue,exception); if (preview_image == (Image *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* Dump image as bitmap. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%BeginPreview: %.20g %.20g %.20g %.20g\n%% ",(double) preview_image->columns,(double) preview_image->rows,1.0, (double) ((((preview_image->columns+7) >> 3)*preview_image->rows+ 35)/36)); (void) WriteBlobString(image,buffer); q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(preview_image,0,y,preview_image->columns,1, exception); if (p == (const Quantum *) NULL) break; bit=0; byte=0; for (x=0; x < (ssize_t) preview_image->columns; x++) { byte<<=1; pixel=ClampToQuantum(GetPixelLuma(preview_image,p)); if (pixel >= (Quantum) (QuantumRange/2)) byte|=0x01; bit++; if (bit == 8) { q=PopHexPixel(hex_digits,byte,q); if ((q-pixels+8) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; (void) WriteBlobString(image,"% "); }; bit=0; byte=0; } } if (bit != 0) { byte<<=(8-bit); q=PopHexPixel(hex_digits,byte,q); if ((q-pixels+8) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; (void) WriteBlobString(image,"% "); }; }; } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } (void) WriteBlobString(image,"\n%%EndPreview\n"); preview_image=DestroyImage(preview_image); } /* Output Postscript commands. */ (void) WriteBlob(image,sizeof(PostscriptProlog)-1, (const unsigned char *) PostscriptProlog); value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) { (void) WriteBlobString(image, " /Times-Roman findfont pointsize scalefont setfont\n"); for (j=(ssize_t) MultilineCensus(value)-1; j >= 0; j--) { (void) WriteBlobString(image," /label 512 string def\n"); (void) WriteBlobString(image, " currentfile label readline pop\n"); (void) FormatLocaleString(buffer,MagickPathExtent, " 0 y %g add moveto label show pop\n",j*pointsize+12); (void) WriteBlobString(image,buffer); } } (void) WriteBlob(image,sizeof(PostscriptEpilog)-1, (const unsigned char *) PostscriptEpilog); if (LocaleCompare(image_info->magick,"PS") == 0) (void) WriteBlobString(image," showpage\n"); (void) WriteBlobString(image,"} bind def\n"); (void) WriteBlobString(image,"%%EndProlog\n"); } (void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Page: 1 %.20g\n", (double) (page++)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%PageBoundingBox: %.20g %.20g %.20g %.20g\n",(double) geometry.x, (double) geometry.y,geometry.x+(double) geometry.width,geometry.y+(double) (geometry.height+text_size)); (void) WriteBlobString(image,buffer); if ((double) geometry.x < bounds.x1) bounds.x1=(double) geometry.x; if ((double) geometry.y < bounds.y1) bounds.y1=(double) geometry.y; if ((double) (geometry.x+geometry.width-1) > bounds.x2) bounds.x2=(double) geometry.x+geometry.width-1; if ((double) (geometry.y+(geometry.height+text_size)-1) > bounds.y2) bounds.y2=(double) geometry.y+(geometry.height+text_size)-1; value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) (void) WriteBlobString(image,"%%%%PageResources: font Times-Roman\n"); if (LocaleCompare(image_info->magick,"PS") != 0) (void) WriteBlobString(image,"userdict begin\n"); (void) WriteBlobString(image,"DisplayImage\n"); /* Output image data. */ (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g %.20g\n%g %g\n%g\n", (double) geometry.x,(double) geometry.y,scale.x,scale.y,pointsize); (void) WriteBlobString(image,buffer); labels=(char **) NULL; value=GetImageProperty(image,"label",exception); if (value != (const char *) NULL) labels=StringToList(value); if (labels != (char **) NULL) { for (i=0; labels[i] != (char *) NULL; i++) { (void) FormatLocaleString(buffer,MagickPathExtent,"%s \n", labels[i]); (void) WriteBlobString(image,buffer); labels[i]=DestroyString(labels[i]); } labels=(char **) RelinquishMagickMemory(labels); } (void) memset(&pixel,0,sizeof(pixel)); pixel.alpha=(MagickRealType) TransparentAlpha; index=(Quantum) 0; x=0; if ((image_info->type != TrueColorType) && (SetImageGray(image,exception) != MagickFalse)) { if (SetImageMonochrome(image,exception) == MagickFalse) { Quantum pixel; /* Dump image as grayscale. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%.20g %.20g\n1\n1\n1\n8\n",(double) image->columns,(double) image->rows); (void) WriteBlobString(image,buffer); q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { pixel=(Quantum) ScaleQuantumToChar(ClampToQuantum(GetPixelLuma( image,p))); q=PopHexPixel(hex_digits,(size_t) pixel,q); if ((q-pixels+8) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } p+=GetPixelChannels(image); } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } } else { ssize_t y; Quantum pixel; /* Dump image as bitmap. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%.20g %.20g\n1\n1\n1\n1\n",(double) image->columns,(double) image->rows); (void) WriteBlobString(image,buffer); q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; bit=0; byte=0; for (x=0; x < (ssize_t) image->columns; x++) { byte<<=1; pixel=ClampToQuantum(GetPixelLuma(image,p)); if (pixel >= (Quantum) (QuantumRange/2)) byte|=0x01; bit++; if (bit == 8) { q=PopHexPixel(hex_digits,byte,q); if ((q-pixels+2) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; }; bit=0; byte=0; } p+=GetPixelChannels(image); } if (bit != 0) { byte<<=(8-bit); q=PopHexPixel(hex_digits,byte,q); if ((q-pixels+2) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } }; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } } } else if ((image->storage_class == DirectClass) || (image->colors > 256) || (image->alpha_trait != UndefinedPixelTrait)) { /* Dump DirectClass image. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%.20g %.20g\n0\n%d\n",(double) image->columns,(double) image->rows, compression == RLECompression ? 1 : 0); (void) WriteBlobString(image,buffer); switch (compression) { case RLECompression: { /* Dump runlength-encoded DirectColor packets. */ q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; GetPixelInfoPixel(image,p,&pixel); length=255; for (x=0; x < (ssize_t) image->columns; x++) { if ((GetPixelRed(image,p) == ClampToQuantum(pixel.red)) && (GetPixelGreen(image,p) == ClampToQuantum(pixel.green)) && (GetPixelBlue(image,p) == ClampToQuantum(pixel.blue)) && (GetPixelAlpha(image,p) == ClampToQuantum(pixel.alpha)) && (length < 255) && (x < (ssize_t) (image->columns-1))) length++; else { if (x > 0) { WriteRunlengthPacket(image,pixel,length,p); if ((q-pixels+10) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } } length=0; } GetPixelInfoPixel(image,p,&pixel); p+=GetPixelChannels(image); } WriteRunlengthPacket(image,pixel,length,p); if ((q-pixels+10) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag, (MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } break; } case NoCompression: default: { /* Dump uncompressed DirectColor packets. */ q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if ((image->alpha_trait != UndefinedPixelTrait) && (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha)) { q=PopHexPixel(hex_digits,0xff,q); q=PopHexPixel(hex_digits,0xff,q); q=PopHexPixel(hex_digits,0xff,q); } else { q=PopHexPixel(hex_digits,ScaleQuantumToChar( GetPixelRed(image,p)),q); q=PopHexPixel(hex_digits,ScaleQuantumToChar( GetPixelGreen(image,p)),q); q=PopHexPixel(hex_digits,ScaleQuantumToChar( GetPixelBlue(image,p)),q); } if ((q-pixels+6) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } p+=GetPixelChannels(image); } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag, (MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } break; } } (void) WriteBlobByte(image,'\n'); } else { /* Dump PseudoClass image. */ (void) FormatLocaleString(buffer,MagickPathExtent, "%.20g %.20g\n%d\n%d\n0\n",(double) image->columns,(double) image->rows,image->storage_class == PseudoClass ? 1 : 0, compression == RLECompression ? 1 : 0); (void) WriteBlobString(image,buffer); /* Dump number of colors and colormap. */ (void) FormatLocaleString(buffer,MagickPathExtent,"%.20g\n",(double) image->colors); (void) WriteBlobString(image,buffer); for (i=0; i < (ssize_t) image->colors; i++) { (void) FormatLocaleString(buffer,MagickPathExtent,"%02X%02X%02X\n", ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red)), ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green)), ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue))); (void) WriteBlobString(image,buffer); } switch (compression) { case RLECompression: { /* Dump runlength-encoded PseudoColor packets. */ q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; index=GetPixelIndex(image,p); length=255; for (x=0; x < (ssize_t) image->columns; x++) { if ((index == GetPixelIndex(image,p)) && (length < 255) && (x < ((ssize_t) image->columns-1))) length++; else { if (x > 0) { q=PopHexPixel(hex_digits,(size_t) index,q); q=PopHexPixel(hex_digits,(size_t) MagickMin(length,0xff),q); i++; if ((q-pixels+6) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } } length=0; } index=GetPixelIndex(image,p); pixel.red=(MagickRealType) GetPixelRed(image,p); pixel.green=(MagickRealType) GetPixelGreen(image,p); pixel.blue=(MagickRealType) GetPixelBlue(image,p); pixel.alpha=(MagickRealType) GetPixelAlpha(image,p); p+=GetPixelChannels(image); } q=PopHexPixel(hex_digits,(size_t) index,q); q=PopHexPixel(hex_digits,(size_t) MagickMin(length,0xff),q); if ((q-pixels+6) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag, (MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } break; } case NoCompression: default: { /* Dump uncompressed PseudoColor packets. */ q=pixels; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,exception); if (p == (const Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { q=PopHexPixel(hex_digits,(size_t) GetPixelIndex(image,p),q); if ((q-pixels+4) >= 80) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); q=pixels; } p+=GetPixelChannels(image); } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,SaveImageTag, (MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } if (q != pixels) { *q++='\n'; (void) WriteBlob(image,q-pixels,pixels); } break; } } (void) WriteBlobByte(image,'\n'); } if (LocaleCompare(image_info->magick,"PS") != 0) (void) WriteBlobString(image,"end\n"); (void) WriteBlobString(image,"%%PageTrailer\n"); if (GetNextImageInList(image) == (Image *) NULL) break; image=SyncNextImageInList(image); status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); if (status == MagickFalse) break; } while (image_info->adjoin != MagickFalse); (void) WriteBlobString(image,"%%Trailer\n"); if (page > 2) { (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5), ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,bounds.x2, bounds.y2); (void) WriteBlobString(image,buffer); } (void) WriteBlobString(image,"%%EOF\n"); (void) CloseBlob(image); return(MagickTrue); }
2,834
102,603
0
void BrowserPolicyConnector::FetchDevicePolicy() { #if defined(OS_CHROMEOS) if (device_data_store_.get()) { DCHECK(!device_data_store_->device_token().empty()); device_data_store_->NotifyDeviceTokenChanged(); } #endif }
2,835
101,297
0
bool SyncerUtil::ServerAndLocalOrdersMatch(syncable::Entry* entry) { syncable::Id local_up_to_date_predecessor = entry->Get(PREV_ID); while (!local_up_to_date_predecessor.IsRoot()) { Entry local_prev(entry->trans(), GET_BY_ID, local_up_to_date_predecessor); if (!local_prev.good() || local_prev.Get(IS_DEL)) return false; if (!local_prev.Get(IS_UNAPPLIED_UPDATE) && !local_prev.Get(IS_UNSYNCED)) break; local_up_to_date_predecessor = local_prev.Get(PREV_ID); } syncable::Id server_up_to_date_predecessor = entry->ComputePrevIdFromServerPosition(entry->Get(SERVER_PARENT_ID)); return server_up_to_date_predecessor == local_up_to_date_predecessor; }
2,836
167,431
0
void HTMLStyleElement::setDisabled(bool set_disabled) { if (CSSStyleSheet* style_sheet = sheet()) style_sheet->setDisabled(set_disabled); }
2,837
134,604
0
OSExchangeData::DownloadFileInfo::~DownloadFileInfo() {}
2,838
50,284
0
void drop_privileges(char *username) { struct passwd *user = (struct passwd *) getpwnam(username); if (user == NULL) { fprintf(stderr, _("Failed dropping privileges. The user %s is not a valid username on local system.\n"), username); exit(1); } if (getuid() == 0) { /* process is running as root, drop privileges */ if (setgid(user->pw_gid) != 0) { fprintf(stderr, _("setgid: Error dropping group privileges\n")); exit(1); } if (setuid(user->pw_uid) != 0) { fprintf(stderr, _("setuid: Error dropping user privileges\n")); exit(1); } /* Verify if the privileges were developed. */ if (setuid(0) != -1) { fprintf(stderr, _("Failed to drop privileges\n")); exit(1); } } }
2,839
76,204
0
bool userns_may_setgroups(const struct user_namespace *ns) { bool allowed; mutex_lock(&userns_state_mutex); /* It is not safe to use setgroups until a gid mapping in * the user namespace has been established. */ allowed = ns->gid_map.nr_extents != 0; /* Is setgroups allowed? */ allowed = allowed && (ns->flags & USERNS_SETGROUPS_ALLOWED); mutex_unlock(&userns_state_mutex); return allowed; }
2,840
119,808
0
void NavigationControllerImpl::ReloadInternal(bool check_for_repost, ReloadType reload_type) { if (transient_entry_index_ != -1) { NavigationEntryImpl* active_entry = NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); if (!active_entry) return; LoadURL(active_entry->GetURL(), Referrer(), PAGE_TRANSITION_RELOAD, active_entry->extra_headers()); return; } NavigationEntryImpl* entry = NULL; int current_index = -1; if (IsInitialNavigation() && pending_entry_) { entry = pending_entry_; current_index = pending_entry_index_; } else { DiscardNonCommittedEntriesInternal(); current_index = GetCurrentEntryIndex(); if (current_index != -1) { entry = NavigationEntryImpl::FromNavigationEntry( GetEntryAtIndex(current_index)); } } if (!entry) return; if (g_check_for_repost && check_for_repost && entry->GetHasPostData()) { web_contents_->NotifyBeforeFormRepostWarningShow(); pending_reload_ = reload_type; web_contents_->Activate(); web_contents_->GetDelegate()->ShowRepostFormWarningDialog(web_contents_); } else { if (!IsInitialNavigation()) DiscardNonCommittedEntriesInternal(); SiteInstanceImpl* site_instance = entry->site_instance(); if (site_instance && site_instance->HasWrongProcessForURL(entry->GetURL())) { NavigationEntryImpl* nav_entry = NavigationEntryImpl::FromNavigationEntry( CreateNavigationEntry( entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(), false, entry->extra_headers(), browser_context_)); reload_type = NavigationController::NO_RELOAD; nav_entry->set_should_replace_entry(true); pending_entry_ = nav_entry; } else { pending_entry_ = entry; pending_entry_index_ = current_index; pending_entry_->SetTitle(string16()); pending_entry_->SetTransitionType(PAGE_TRANSITION_RELOAD); } NavigateToPendingEntry(reload_type); } }
2,841
72,220
0
get_connection_info(int populate, int use_dns) { struct ssh *ssh = active_state; /* XXX */ static struct connection_info ci; if (!populate) return &ci; ci.host = auth_get_canonical_hostname(ssh, use_dns); ci.address = ssh_remote_ipaddr(ssh); ci.laddress = ssh_local_ipaddr(ssh); ci.lport = ssh_local_port(ssh); return &ci; }
2,842
179,651
1
int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { struct inet_sock *inet = inet_sk(sk); struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; struct sk_buff *skb; unsigned int ulen, copied; int peeked, off = 0; int err; int is_udplite = IS_UDPLITE(sk); bool slow; /* * Check any passed addresses * if (addr_len) *addr_len = sizeof(*sin); if (flags & MSG_ERRQUEUE) return ip_recv_error(sk, msg, len); try_again: skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), &peeked, &off, &err); if (!skb) goto out; ulen = skb->len - sizeof(struct udphdr); copied = len; if (copied > ulen) copied = ulen; else if (copied < ulen) msg->msg_flags |= MSG_TRUNC; /* * If checksum is needed at all, try to do it while copying the * data. If the data is truncated, or if we only want a partial * coverage checksum (UDP-Lite), do it before the copy. */ if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { if (udp_lib_checksum_complete(skb)) goto csum_copy_err; } if (skb_csum_unnecessary(skb)) err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov, copied); else { err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); if (err == -EINVAL) goto csum_copy_err; } if (unlikely(err)) { trace_kfree_skb(skb, udp_recvmsg); if (!peeked) { atomic_inc(&sk->sk_drops); UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); } goto out_free; } if (!peeked) UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INDATAGRAMS, is_udplite); sock_recv_ts_and_drops(msg, sk, skb); /* Copy the address. */ if (sin) { sin->sin_family = AF_INET; sin->sin_port = udp_hdr(skb)->source; sin->sin_addr.s_addr = ip_hdr(skb)->saddr; memset(sin->sin_zero, 0, sizeof(sin->sin_zero)); } if (inet->cmsg_flags) ip_cmsg_recv(msg, skb); err = copied; if (flags & MSG_TRUNC) err = ulen; out_free: skb_free_datagram_locked(sk, skb); out: return err; csum_copy_err: slow = lock_sock_fast(sk); if (!skb_kill_datagram(sk, skb, flags)) { UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); } unlock_sock_fast(sk, slow); if (noblock) return -EAGAIN; /* starting over for a new packet */ msg->msg_flags &= ~MSG_TRUNC; goto try_again; }
2,843
110,302
0
void HistogramEnumerate(const std::string& name, int sample, int maximum, int out_of_range_replacement) { if (sample < 0 || sample >= maximum) { if (out_of_range_replacement < 0) return; else sample = out_of_range_replacement; } const PPB_UMA_Private* ptr = GetUMAInterface(); if (ptr == NULL) return; ptr->HistogramEnumeration(pp::Var(name).pp_var(), sample, maximum); }
2,844
993
0
GfxColorSpace *GfxLabColorSpace::copy() { GfxLabColorSpace *cs; cs = new GfxLabColorSpace(); cs->whiteX = whiteX; cs->whiteY = whiteY; cs->whiteZ = whiteZ; cs->blackX = blackX; cs->blackY = blackY; cs->blackZ = blackZ; cs->aMin = aMin; cs->aMax = aMax; cs->bMin = bMin; cs->bMax = bMax; cs->kr = kr; cs->kg = kg; cs->kb = kb; return cs; }
2,845
17,095
0
QQmlComponent* OxideQQuickWebView::filePicker() const { Q_D(const OxideQQuickWebView); return d->file_picker_; }
2,846
168,838
0
ExtensionFunction::ResponseAction TabsGetSelectedFunction::Run() { int window_id = extension_misc::kCurrentWindowId; std::unique_ptr<tabs::GetSelected::Params> params( tabs::GetSelected::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); if (params->window_id.get()) window_id = *params->window_id; Browser* browser = NULL; std::string error; if (!GetBrowserFromWindowID(this, window_id, &browser, &error)) return RespondNow(Error(error)); TabStripModel* tab_strip = browser->tab_strip_model(); WebContents* contents = tab_strip->GetActiveWebContents(); if (!contents) return RespondNow(Error(keys::kNoSelectedTabError)); return RespondNow(ArgumentList( tabs::Get::Results::Create(*ExtensionTabUtil::CreateTabObject( contents, ExtensionTabUtil::kScrubTab, extension(), tab_strip, tab_strip->active_index())))); }
2,847
167,308
0
void ScrollableShelfView::ScrollByYOffset(float y_offset, bool animating) { ScrollToYOffset(scroll_offset_.y() + y_offset, animating); }
2,848
94,848
0
MagickExport MagickBooleanType SetImageAlpha(Image *image,const Quantum alpha, ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType status; ssize_t y; assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); assert(image->signature == MagickCoreSignature); image->alpha_trait=BlendPixelTrait; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ magick_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { if (GetPixelReadMask(image,q) != 0) SetPixelAlpha(image,alpha,q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); return(status); }
2,849
123,506
0
int BlobURLRequestJob::BytesReadCompleted() { int bytes_read = read_buf_->BytesConsumed(); read_buf_ = NULL; return bytes_read; }
2,850
90,764
0
static av_cold int hevc_init_thread_copy(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int ret; memset(s, 0, sizeof(*s)); ret = hevc_init_context(avctx); if (ret < 0) return ret; return 0; }
2,851
143,684
0
void RenderWidgetHostImpl::OnUnlockMouse() { RejectMouseLockOrUnlockIfNecessary(); }
2,852
119,857
0
void WebContentsImpl::ShowCreatedWidget(int route_id, bool is_fullscreen, const gfx::Rect& initial_pos) { if (delegate_) delegate_->RenderWidgetShowing(); RenderWidgetHostViewPort* widget_host_view = RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); if (!widget_host_view) return; if (is_fullscreen) widget_host_view->InitAsFullscreen(GetRenderWidgetHostViewPort()); else widget_host_view->InitAsPopup(GetRenderWidgetHostViewPort(), initial_pos); RenderWidgetHostImpl* render_widget_host_impl = RenderWidgetHostImpl::From(widget_host_view->GetRenderWidgetHost()); render_widget_host_impl->Init(); render_widget_host_impl->set_allow_privileged_mouse_lock(is_fullscreen); #if defined(OS_MACOSX) base::mac::NSObjectRelease(widget_host_view->GetNativeView()); #endif }
2,853
138,385
0
void StartOnIOThread() { DCHECK(io_thread_checker_.CalledOnValidThread()); service_context_.reset(new service_manager::ServiceContext( base::MakeUnique<service_manager::ForwardingService>(this), std::move(pending_service_request_), std::move(io_thread_connector_), std::move(pending_connector_request_))); message_loop_observer_ = new MessageLoopObserver(weak_factory_.GetWeakPtr()); }
2,854
186,050
1
bool WebstoreStandaloneInstaller::EnsureUniqueInstall( webstore_install::Result* reason, std::string* error) { InstallTracker* tracker = InstallTracker::Get(profile_); DCHECK(tracker); const ActiveInstallData* existing_install_data = tracker->GetActiveInstall(id_); if (existing_install_data) { *reason = webstore_install::INSTALL_IN_PROGRESS; *error = kInstallInProgressError; return false; } ActiveInstallData install_data(id_); InitInstallData(&install_data); scoped_active_install_.reset(new ScopedActiveInstall(tracker, install_data)); return true; }
2,855
123,871
0
void RenderViewImpl::InstrumentDidCancelFrame() { if (!webview()) return; if (!webview()->devToolsAgent()) return; webview()->devToolsAgent()->didCancelFrame(); }
2,856
62,146
0
static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception) { printf("Your PNG library is too old: You have libpng-%s\n", PNG_LIBPNG_VER_STRING); (void) ThrowMagickException(exception,GetMagickModule(),CoderError, "PNG library is too old","`%s'",image_info->filename); return(Image *) NULL; }
2,857
182,662
1
vips_foreign_load_gif_scan_image( VipsForeignLoadGif *gif ) { VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif ); GifFileType *file = gif->file; ColorMapObject *map = file->Image.ColorMap ? file->Image.ColorMap : file->SColorMap; GifByteType *extension; if( DGifGetImageDesc( gif->file ) == GIF_ERROR ) { vips_foreign_load_gif_error( gif ); return( -1 ); } /* Check that the frame looks sane. Perhaps giflib checks * this for us. */ if( file->Image.Left < 0 || file->Image.Width < 1 || file->Image.Width > 10000 || file->Image.Left + file->Image.Width > file->SWidth || file->Image.Top < 0 || file->Image.Height < 1 || file->Image.Height > 10000 || file->Image.Top + file->Image.Height > file->SHeight ) { vips_error( class->nickname, "%s", _( "bad frame size" ) ); return( -1 ); } /* Test for a non-greyscale colourmap for this frame. */ if( !gif->has_colour && map ) { int i; for( i = 0; i < map->ColorCount; i++ ) if( map->Colors[i].Red != map->Colors[i].Green || map->Colors[i].Green != map->Colors[i].Blue ) { gif->has_colour = TRUE; break; } } /* Step over compressed image data. */ do { if( vips_foreign_load_gif_code_next( gif, &extension ) ) return( -1 ); } while( extension != NULL ); return( 0 ); }
2,858
115,627
0
void GraphicsContext::setLineCap(LineCap cap) { if (paintingDisabled()) return; switch (cap) { case ButtCap: platformContext()->setLineCap(SkPaint::kButt_Cap); break; case RoundCap: platformContext()->setLineCap(SkPaint::kRound_Cap); break; case SquareCap: platformContext()->setLineCap(SkPaint::kSquare_Cap); break; default: ASSERT(0); break; } }
2,859
80,420
0
GF_Err snro_Size(GF_Box *s) { s->size += 4; return GF_OK; }
2,860
29,052
0
int ssl_write_change_cipher_spec( ssl_context *ssl ) { int ret; SSL_DEBUG_MSG( 2, ( "=> write change cipher spec" ) ); ssl->out_msgtype = SSL_MSG_CHANGE_CIPHER_SPEC; ssl->out_msglen = 1; ssl->out_msg[0] = 1; ssl->state++; if( ( ret = ssl_write_record( ssl ) ) != 0 ) { SSL_DEBUG_RET( 1, "ssl_write_record", ret ); return( ret ); } SSL_DEBUG_MSG( 2, ( "<= write change cipher spec" ) ); return( 0 ); }
2,861
441
0
pdf_cmap_wmode(fz_context *ctx, pdf_cmap *cmap) { return cmap->wmode; }
2,862
42,413
0
int md_allow_write(struct mddev *mddev) { if (!mddev->pers) return 0; if (mddev->ro) return 0; if (!mddev->pers->sync_request) return 0; spin_lock(&mddev->lock); if (mddev->in_sync) { mddev->in_sync = 0; set_bit(MD_CHANGE_CLEAN, &mddev->flags); set_bit(MD_CHANGE_PENDING, &mddev->flags); if (mddev->safemode_delay && mddev->safemode == 0) mddev->safemode = 1; spin_unlock(&mddev->lock); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_start(mddev); md_update_sb(mddev, 0); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_finish(mddev); sysfs_notify_dirent_safe(mddev->sysfs_state); } else spin_unlock(&mddev->lock); if (test_bit(MD_CHANGE_PENDING, &mddev->flags)) return -EAGAIN; else return 0; }
2,863
33,584
0
static void receive_packet(node_t *n, vpn_packet_t *packet) { ifdebug(TRAFFIC) logger(LOG_DEBUG, "Received packet of %d bytes from %s (%s)", packet->len, n->name, n->hostname); route(n, packet); }
2,864
9,338
0
static void sysbus_esp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = sysbus_esp_realize; dc->reset = sysbus_esp_hard_reset; dc->vmsd = &vmstate_sysbus_esp_scsi; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
2,865
110,770
0
bool AutocompleteEditModel::AcceptCurrentInstantPreview() { return InstantController::CommitIfCurrent(controller_->GetInstant()); }
2,866
128,585
0
bool Instance::Init(uint32_t argc, const char* argn[], const char* argv[]) { if (pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_HIDPI)) hidpi_enabled_ = true; printing_enabled_ = pp::PDF::IsFeatureEnabled(this, PP_PDFFEATURE_PRINTING); if (printing_enabled_) { CreateToolbar(kPDFToolbarButtons, arraysize(kPDFToolbarButtons)); } else { CreateToolbar(kPDFNoPrintToolbarButtons, arraysize(kPDFNoPrintToolbarButtons)); } CreateProgressBar(); autoscroll_anchor_ = CreateResourceImage(PP_RESOURCEIMAGE_PDF_PAN_SCROLL_ICON); #ifdef ENABLE_THUMBNAILS CreateThumbnails(); #endif const char* url = NULL; for (uint32_t i = 0; i < argc; ++i) { if (strcmp(argn[i], "src") == 0) { url = argv[i]; break; } } if (!url) return false; CreatePageIndicator(IsPrintPreviewUrl(url)); if (!full_) { LoadUrl(url); } else { DCHECK(!did_call_start_loading_); pp::PDF::DidStartLoading(this); did_call_start_loading_ = true; } ZoomLimitsChanged(kMinZoom, kMaxZoom); text_input_.reset(new pp::TextInput_Dev(this)); url_ = url; return engine_->New(url); }
2,867
50,362
0
struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type) { struct ocfs2_super *osb; struct buffer_head *di_bh = NULL; struct posix_acl *acl; int ret; osb = OCFS2_SB(inode->i_sb); if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) return NULL; ret = ocfs2_inode_lock(inode, &di_bh, 0); if (ret < 0) { if (ret != -ENOENT) mlog_errno(ret); return ERR_PTR(ret); } acl = ocfs2_get_acl_nolock(inode, type, di_bh); ocfs2_inode_unlock(inode, 0); brelse(di_bh); return acl; }
2,868
22,936
0
nfs4_free_open_state(struct nfs4_state *state) { kfree(state); }
2,869
32,404
0
static void mntns_put(void *ns) { put_mnt_ns(ns); }
2,870
99,689
0
void VaapiWrapper::DestroyPendingBuffers() { base::AutoLock auto_lock(*va_lock_); for (const auto& pending_va_buf : pending_va_bufs_) { VAStatus va_res = vaDestroyBuffer(va_display_, pending_va_buf); VA_LOG_ON_ERROR(va_res, "vaDestroyBuffer failed"); } for (const auto& pending_slice_buf : pending_slice_bufs_) { VAStatus va_res = vaDestroyBuffer(va_display_, pending_slice_buf); VA_LOG_ON_ERROR(va_res, "vaDestroyBuffer failed"); } pending_va_bufs_.clear(); pending_slice_bufs_.clear(); }
2,871
18,205
0
static char *server_create_address_tag(const char *address) { const char *start, *end; g_return_val_if_fail(address != NULL, NULL); /* try to generate a reasonable server tag */ if (strchr(address, '.') == NULL) { start = end = NULL; } else if (g_ascii_strncasecmp(address, "irc", 3) == 0 || g_ascii_strncasecmp(address, "chat", 4) == 0) { /* irc-2.cs.hut.fi -> hut, chat.bt.net -> bt */ end = strrchr(address, '.'); start = end-1; while (start > address && *start != '.') start--; } else { /* efnet.cs.hut.fi -> efnet */ end = strchr(address, '.'); start = end; } if (start == end) start = address; else start++; if (end == NULL) end = address + strlen(address); return g_strndup(start, (int) (end-start)); }
2,872
110,491
0
bool GLES2DecoderImpl::DoIsProgram(GLuint client_id) { const ProgramManager::ProgramInfo* program = GetProgramInfo(client_id); return program != NULL && !program->IsDeleted(); }
2,873
3,963
0
GooString *RunLengthStream::getPSFilter(int psLevel, const char *indent) { GooString *s; if (psLevel < 2) { return NULL; } if (!(s = str->getPSFilter(psLevel, indent))) { return NULL; } s->append(indent)->append("/RunLengthDecode filter\n"); return s; }
2,874
62,282
0
rx_print(netdissect_options *ndo, register const u_char *bp, int length, int sport, int dport, const u_char *bp2) { register const struct rx_header *rxh; int i; int32_t opcode; if (ndo->ndo_snapend - bp < (int)sizeof (struct rx_header)) { ND_PRINT((ndo, " [|rx] (%d)", length)); return; } rxh = (const struct rx_header *) bp; ND_PRINT((ndo, " rx %s", tok2str(rx_types, "type %d", rxh->type))); if (ndo->ndo_vflag) { int firstflag = 0; if (ndo->ndo_vflag > 1) ND_PRINT((ndo, " cid %08x call# %d", (int) EXTRACT_32BITS(&rxh->cid), (int) EXTRACT_32BITS(&rxh->callNumber))); ND_PRINT((ndo, " seq %d ser %d", (int) EXTRACT_32BITS(&rxh->seq), (int) EXTRACT_32BITS(&rxh->serial))); if (ndo->ndo_vflag > 2) ND_PRINT((ndo, " secindex %d serviceid %hu", (int) rxh->securityIndex, EXTRACT_16BITS(&rxh->serviceId))); if (ndo->ndo_vflag > 1) for (i = 0; i < NUM_RX_FLAGS; i++) { if (rxh->flags & rx_flags[i].flag && (!rx_flags[i].packetType || rxh->type == rx_flags[i].packetType)) { if (!firstflag) { firstflag = 1; ND_PRINT((ndo, " ")); } else { ND_PRINT((ndo, ",")); } ND_PRINT((ndo, "<%s>", rx_flags[i].s)); } } } /* * Try to handle AFS calls that we know about. Check the destination * port and make sure it's a data packet. Also, make sure the * seq number is 1 (because otherwise it's a continuation packet, * and we can't interpret that). Also, seems that reply packets * do not have the client-init flag set, so we check for that * as well. */ if (rxh->type == RX_PACKET_TYPE_DATA && EXTRACT_32BITS(&rxh->seq) == 1 && rxh->flags & RX_CLIENT_INITIATED) { /* * Insert this call into the call cache table, so we * have a chance to print out replies */ rx_cache_insert(ndo, bp, (const struct ip *) bp2, dport); switch (dport) { case FS_RX_PORT: /* AFS file service */ fs_print(ndo, bp, length); break; case CB_RX_PORT: /* AFS callback service */ cb_print(ndo, bp, length); break; case PROT_RX_PORT: /* AFS protection service */ prot_print(ndo, bp, length); break; case VLDB_RX_PORT: /* AFS VLDB service */ vldb_print(ndo, bp, length); break; case KAUTH_RX_PORT: /* AFS Kerberos auth service */ kauth_print(ndo, bp, length); break; case VOL_RX_PORT: /* AFS Volume service */ vol_print(ndo, bp, length); break; case BOS_RX_PORT: /* AFS BOS service */ bos_print(ndo, bp, length); break; default: ; } /* * If it's a reply (client-init is _not_ set, but seq is one) * then look it up in the cache. If we find it, call the reply * printing functions Note that we handle abort packets here, * because printing out the return code can be useful at times. */ } else if (((rxh->type == RX_PACKET_TYPE_DATA && EXTRACT_32BITS(&rxh->seq) == 1) || rxh->type == RX_PACKET_TYPE_ABORT) && (rxh->flags & RX_CLIENT_INITIATED) == 0 && rx_cache_find(rxh, (const struct ip *) bp2, sport, &opcode)) { switch (sport) { case FS_RX_PORT: /* AFS file service */ fs_reply_print(ndo, bp, length, opcode); break; case CB_RX_PORT: /* AFS callback service */ cb_reply_print(ndo, bp, length, opcode); break; case PROT_RX_PORT: /* AFS PT service */ prot_reply_print(ndo, bp, length, opcode); break; case VLDB_RX_PORT: /* AFS VLDB service */ vldb_reply_print(ndo, bp, length, opcode); break; case KAUTH_RX_PORT: /* AFS Kerberos auth service */ kauth_reply_print(ndo, bp, length, opcode); break; case VOL_RX_PORT: /* AFS Volume service */ vol_reply_print(ndo, bp, length, opcode); break; case BOS_RX_PORT: /* AFS BOS service */ bos_reply_print(ndo, bp, length, opcode); break; default: ; } /* * If it's an RX ack packet, then use the appropriate ack decoding * function (there isn't any service-specific information in the * ack packet, so we can use one for all AFS services) */ } else if (rxh->type == RX_PACKET_TYPE_ACK) rx_ack_print(ndo, bp, length); ND_PRINT((ndo, " (%d)", length)); }
2,875
142,513
0
bool IsDoneAnimating() const { gfx::Rect current_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); return current_bounds.origin() == target_bounds_.origin(); }
2,876
3,262
0
ref_param_begin_read_collection(gs_param_list * plist, gs_param_name pkey, gs_param_dict * pvalue, gs_param_collection_type_t coll_type) { iparam_list *const iplist = (iparam_list *) plist; iparam_loc loc; bool int_keys = coll_type != 0; int code = ref_param_read(iplist, pkey, &loc, -1); dict_param_list *dlist; if (code != 0) return code; dlist = (dict_param_list *) gs_alloc_bytes(plist->memory, size_of(dict_param_list), "ref_param_begin_read_collection"); if (dlist == 0) return_error(gs_error_VMerror); if (r_has_type(loc.pvalue, t_dictionary)) { code = dict_param_list_read(dlist, loc.pvalue, NULL, false, iplist->ref_memory); dlist->int_keys = int_keys; if (code >= 0) pvalue->size = dict_length(loc.pvalue); } else if (int_keys && r_is_array(loc.pvalue)) { code = array_indexed_param_list_read(dlist, loc.pvalue, NULL, false, iplist->ref_memory); if (code >= 0) pvalue->size = r_size(loc.pvalue); } else code = gs_note_error(gs_error_typecheck); if (code < 0) { gs_free_object(plist->memory, dlist, "ref_param_begin_write_collection"); return iparam_note_error(loc, code); } pvalue->list = (gs_param_list *) dlist; return 0; }
2,877
4,293
0
PHP_FUNCTION(getprotobynumber) { long proto; struct protoent *ent; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &proto) == FAILURE) { return; } ent = getprotobynumber(proto); if (ent == NULL) { RETURN_FALSE; } RETURN_STRING(ent->p_name, 1); }
2,878
172,982
0
static void rpng2_x_reload_bg_image(void) { char *dest; uch r1, r2, g1, g2, b1, b2; uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv; int k, hmax, max; int xidx, yidx, yidx_max; int even_odd_vert, even_odd_horiz, even_odd; int invert_gradient2 = (bg[pat].type & 0x08); int invert_column; ulg i, row; bgscale = (pat == 0)? 8 : bgscale_default; yidx_max = bgscale - 1; /*--------------------------------------------------------------------------- Vertical gradients (ramps) in NxN squares, alternating direction and colors (N == bgscale). ---------------------------------------------------------------------------*/ if ((bg[pat].type & 0x07) == 0) { uch r1_min = rgb[bg[pat].rgb1_min].r; uch g1_min = rgb[bg[pat].rgb1_min].g; uch b1_min = rgb[bg[pat].rgb1_min].b; uch r2_min = rgb[bg[pat].rgb2_min].r; uch g2_min = rgb[bg[pat].rgb2_min].g; uch b2_min = rgb[bg[pat].rgb2_min].b; int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min; int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min; int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min; int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min; int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min; int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min; for (row = 0; row < rpng2_info.height; ++row) { yidx = (int)(row % bgscale); even_odd_vert = (int)((row / bgscale) & 1); r1 = r1_min + (r1_diff * yidx) / yidx_max; g1 = g1_min + (g1_diff * yidx) / yidx_max; b1 = b1_min + (b1_diff * yidx) / yidx_max; r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max; g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max; b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max; r2 = r2_min + (r2_diff * yidx) / yidx_max; g2 = g2_min + (g2_diff * yidx) / yidx_max; b2 = b2_min + (b2_diff * yidx) / yidx_max; r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max; g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max; b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max; dest = (char *)bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { even_odd_horiz = (int)((i / bgscale) & 1); even_odd = even_odd_vert ^ even_odd_horiz; invert_column = (even_odd_horiz && (bg[pat].type & 0x10)); if (even_odd == 0) { /* gradient #1 */ if (invert_column) { *dest++ = r1_inv; *dest++ = g1_inv; *dest++ = b1_inv; } else { *dest++ = r1; *dest++ = g1; *dest++ = b1; } } else { /* gradient #2 */ if ((invert_column && invert_gradient2) || (!invert_column && !invert_gradient2)) { *dest++ = r2; /* not inverted or */ *dest++ = g2; /* doubly inverted */ *dest++ = b2; } else { *dest++ = r2_inv; *dest++ = g2_inv; /* singly inverted */ *dest++ = b2_inv; } } } } /*--------------------------------------------------------------------------- Soft gradient-diamonds with scale = bgscale. Code contributed by Adam M. Costello. ---------------------------------------------------------------------------*/ } else if ((bg[pat].type & 0x07) == 1) { hmax = (bgscale-1)/2; /* half the max weight of a color */ max = 2*hmax; /* the max weight of a color */ r1 = rgb[bg[pat].rgb1_max].r; g1 = rgb[bg[pat].rgb1_max].g; b1 = rgb[bg[pat].rgb1_max].b; r2 = rgb[bg[pat].rgb2_max].r; g2 = rgb[bg[pat].rgb2_max].g; b2 = rgb[bg[pat].rgb2_max].b; for (row = 0; row < rpng2_info.height; ++row) { yidx = (int)(row % bgscale); if (yidx > hmax) yidx = bgscale-1 - yidx; dest = (char *)bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { xidx = (int)(i % bgscale); if (xidx > hmax) xidx = bgscale-1 - xidx; k = xidx + yidx; *dest++ = (k*r1 + (max-k)*r2) / max; *dest++ = (k*g1 + (max-k)*g2) / max; *dest++ = (k*b1 + (max-k)*b2) / max; } } /*--------------------------------------------------------------------------- Radial "starburst" with azimuthal sinusoids; [eventually number of sinu- soids will equal bgscale?]. This one is slow but very cool. Code con- tributed by Pieter S. van der Meulen (originally in Smalltalk). ---------------------------------------------------------------------------*/ } else if ((bg[pat].type & 0x07) == 2) { uch ch; int ii, x, y, hw, hh, grayspot; double freq, rotate, saturate, gray, intensity; double angle=0.0, aoffset=0.0, maxDist, dist; double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t; hh = (int)(rpng2_info.height / 2); hw = (int)(rpng2_info.width / 2); /* variables for radial waves: * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED] * freq: number of color beams originating from the center * grayspot: size of the graying center area (anti-alias) * rotate: rotation of the beams as a function of radius * saturate: saturation of beams' shape azimuthally */ angle = CLIP(angle, 0.0, 360.0); grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw)); freq = MAX((double)bg[pat].bg_freq, 0.0); saturate = (double)bg[pat].bg_bsat * 0.1; rotate = (double)bg[pat].bg_brot * 0.1; gray = 0.0; intensity = 0.0; maxDist = (double)((hw*hw) + (hh*hh)); for (row = 0; row < rpng2_info.height; ++row) { y = (int)(row - hh); dest = (char *)bg_data + row*bg_rowbytes; for (i = 0; i < rpng2_info.width; ++i) { x = (int)(i - hw); angle = (x == 0)? PI_2 : atan((double)y / (double)x); gray = (double)MAX(ABS(y), ABS(x)) / grayspot; gray = MIN(1.0, gray); dist = (double)((x*x) + (y*y)) / maxDist; intensity = cos((angle+(rotate*dist*PI)) * freq) * gray * saturate; intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5; hue = (angle + PI) * INV_PI_360 + aoffset; s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh)); s = MIN(MAX(s,0.0), 1.0); v = MIN(MAX(intensity,0.0), 1.0); if (s == 0.0) { ch = (uch)(v * 255.0); *dest++ = ch; *dest++ = ch; *dest++ = ch; } else { if ((hue < 0.0) || (hue >= 360.0)) hue -= (((int)(hue / 360.0)) * 360.0); hue /= 60.0; ii = (int)hue; f = hue - (double)ii; p = (1.0 - s) * v; q = (1.0 - (s * f)) * v; t = (1.0 - (s * (1.0 - f))) * v; if (ii == 0) { red = v; green = t; blue = p; } else if (ii == 1) { red = q; green = v; blue = p; } else if (ii == 2) { red = p; green = v; blue = t; } else if (ii == 3) { red = p; green = q; blue = v; } else if (ii == 4) { red = t; green = p; blue = v; } else if (ii == 5) { red = v; green = p; blue = q; } *dest++ = (uch)(red * 255.0); *dest++ = (uch)(green * 255.0); *dest++ = (uch)(blue * 255.0); } } } } } /* end function rpng2_x_reload_bg_image() */
2,879
86,621
0
int fpm_stdio_discard_pipes(struct fpm_child_s *child) /* {{{ */ { if (0 == child->wp->config->catch_workers_output) { /* not required */ return 0; } close(fd_stdout[1]); close(fd_stderr[1]); close(fd_stdout[0]); close(fd_stderr[0]); return 0; } /* }}} */
2,880
85,247
0
static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, struct page *page) { struct f2fs_nm_info *nm_i = NM_I(sbi); unsigned int nat_index = start_nid / NAT_ENTRY_PER_BLOCK; struct f2fs_nat_block *nat_blk = page_address(page); int valid = 0; int i; if (!enabled_nat_bits(sbi, NULL)) return; for (i = 0; i < NAT_ENTRY_PER_BLOCK; i++) { if (start_nid == 0 && i == 0) valid++; if (nat_blk->entries[i].block_addr) valid++; } if (valid == 0) { __set_bit_le(nat_index, nm_i->empty_nat_bits); __clear_bit_le(nat_index, nm_i->full_nat_bits); return; } __clear_bit_le(nat_index, nm_i->empty_nat_bits); if (valid == NAT_ENTRY_PER_BLOCK) __set_bit_le(nat_index, nm_i->full_nat_bits); else __clear_bit_le(nat_index, nm_i->full_nat_bits); }
2,881
149,426
0
bool checkDigest(const String& source, ContentSecurityPolicy::InlineType type, uint8_t hashAlgorithmsUsed, const CSPDirectiveListVector& policies) { static const struct { ContentSecurityPolicyHashAlgorithm cspHashAlgorithm; HashAlgorithm algorithm; } kAlgorithmMap[] = { {ContentSecurityPolicyHashAlgorithmSha1, HashAlgorithmSha1}, {ContentSecurityPolicyHashAlgorithmSha256, HashAlgorithmSha256}, {ContentSecurityPolicyHashAlgorithmSha384, HashAlgorithmSha384}, {ContentSecurityPolicyHashAlgorithmSha512, HashAlgorithmSha512}}; if (hashAlgorithmsUsed == ContentSecurityPolicyHashAlgorithmNone) return false; StringUTF8Adaptor utf8Source(source); for (const auto& algorithmMap : kAlgorithmMap) { DigestValue digest; if (algorithmMap.cspHashAlgorithm & hashAlgorithmsUsed) { bool digestSuccess = computeDigest(algorithmMap.algorithm, utf8Source.data(), utf8Source.length(), digest); if (digestSuccess && isAllowedByAll<allowed>( policies, CSPHashValue(algorithmMap.cspHashAlgorithm, digest), type)) return true; } } return false; }
2,882
136,908
0
void HTMLInputElement::InitializeTypeInParsing() { DCHECK(parsing_in_progress_); DCHECK(!input_type_); DCHECK(!input_type_view_); const AtomicString& new_type_name = InputType::NormalizeTypeName(FastGetAttribute(typeAttr)); input_type_ = InputType::Create(*this, new_type_name); input_type_view_ = input_type_->CreateView(); String default_value = FastGetAttribute(valueAttr); if (input_type_->GetValueMode() == ValueMode::kValue) non_attribute_value_ = SanitizeValue(default_value); has_been_password_field_ |= new_type_name == InputTypeNames::password; if (input_type_view_->NeedsShadowSubtree()) { CreateUserAgentShadowRoot(); CreateShadowSubtree(); } SetNeedsWillValidateCheck(); if (!default_value.IsNull()) input_type_->WarnIfValueIsInvalid(default_value); input_type_view_->UpdateView(); }
2,883
153,925
0
scoped_refptr<VertexAttribManager> CreateVertexAttribManager( GLuint client_id, GLuint service_id, bool client_visible) { return vertex_array_manager()->CreateVertexAttribManager( client_id, service_id, group_->max_vertex_attribs(), client_visible, feature_info_->IsWebGL2OrES3Context()); }
2,884
56,474
0
static inline int get_sigset_t(sigset_t *set, const sigset_t __user *uset) { return copy_from_user(set, uset, sizeof(*uset)); }
2,885
6,912
0
smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_msg *msg; struct chunk *temp; struct hdr_idx *idx; const char *cur_ptr, *cur_next, *p; int old_idx, cur_idx; struct hdr_idx_elem *cur_hdr; const char *hn, *hv; int hnl, hvl; int ret; struct http_txn *txn; char *buf; char *end; CHECK_HTTP_MESSAGE_FIRST(); temp = get_trash_chunk(); buf = temp->str; end = temp->str + temp->size; txn = smp->strm->txn; idx = &txn->hdr_idx; msg = &txn->req; /* Build array of headers. */ old_idx = 0; cur_next = msg->chn->buf->p + hdr_idx_first_pos(idx); while (1) { cur_idx = idx->v[old_idx].next; if (!cur_idx) break; old_idx = cur_idx; cur_hdr = &idx->v[cur_idx]; cur_ptr = cur_next; cur_next = cur_ptr + cur_hdr->len + cur_hdr->cr + 1; /* Now we have one full header at cur_ptr of len cur_hdr->len, * and the next header starts at cur_next. We'll check * this header in the list as well as against the default * rule. */ /* look for ': *'. */ hn = cur_ptr; for (p = cur_ptr; p < cur_ptr + cur_hdr->len && *p != ':'; p++); if (p >= cur_ptr+cur_hdr->len) continue; hnl = p - hn; p++; while (p < cur_ptr + cur_hdr->len && (*p == ' ' || *p == '\t')) p++; if (p >= cur_ptr + cur_hdr->len) continue; hv = p; hvl = cur_ptr + cur_hdr->len-p; /* encode the header name. */ ret = encode_varint(hnl, &buf, end); if (ret == -1) return 0; if (buf + hnl > end) return 0; memcpy(buf, hn, hnl); buf += hnl; /* encode and copy the value. */ ret = encode_varint(hvl, &buf, end); if (ret == -1) return 0; if (buf + hvl > end) return 0; memcpy(buf, hv, hvl); buf += hvl; } /* encode the end of the header list with empty * header name and header value. */ ret = encode_varint(0, &buf, end); if (ret == -1) return 0; ret = encode_varint(0, &buf, end); if (ret == -1) return 0; /* Initialise sample data which will be filled. */ smp->data.type = SMP_T_BIN; smp->data.u.str.str = temp->str; smp->data.u.str.len = buf - temp->str; smp->data.u.str.size = temp->size; return 1; }
2,886
112,020
0
void SyncTest::TriggerMigrationDoneError( syncable::ModelTypeSet model_types) { ASSERT_TRUE(ServerSupportsErrorTriggering()); std::string path = "chromiumsync/migrate"; char joiner = '?'; for (syncable::ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { path.append( base::StringPrintf( "%ctype=%d", joiner, syncable::GetSpecificsFieldNumberFromModelType(it.Get()))); joiner = '&'; } ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Migration: 200", UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); }
2,887
130,371
0
void HTMLFormControlElement::showValidationMessage() { scrollIntoViewIfNeeded(false); RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); focus(); updateVisibleValidationMessage(); }
2,888
127,566
0
XID CreatePictureFromSkiaPixmap(Display* display, XID pixmap) { XID picture = XRenderCreatePicture( display, pixmap, GetRenderARGB32Format(display), 0, NULL); return picture; }
2,889
12,132
0
PHPAPI void var_push_dtor(php_unserialize_data_t *var_hashx, zval **rval) { var_entries *var_hash = (*var_hashx)->last_dtor; #if VAR_ENTRIES_DBG fprintf(stderr, "var_push_dtor(%ld): %d\n", var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval)); #endif if (!var_hash || var_hash->used_slots == VAR_ENTRIES_MAX) { var_hash = emalloc(sizeof(var_entries)); var_hash->used_slots = 0; var_hash->next = 0; if (!(*var_hashx)->first_dtor) { (*var_hashx)->first_dtor = var_hash; } else { ((var_entries *) (*var_hashx)->last_dtor)->next = var_hash; } (*var_hashx)->last_dtor = var_hash; } Z_ADDREF_PP(rval); var_hash->data[var_hash->used_slots++] = *rval; }
2,890
150,603
0
void DataReductionProxyIOData::OnProxyConfigUpdated() { ui_task_runner_->PostTask( FROM_HERE, base::BindOnce(&DataReductionProxyService::SetConfiguredProxiesOnUI, service_, config_->GetAllConfiguredProxies(), config_->GetProxiesForHttp())); UpdateCustomProxyConfig(); UpdateThrottleConfig(); }
2,891
33,711
0
int ptrace_get_breakpoints(struct task_struct *tsk) { if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt)) return 0; return -1; }
2,892
102,563
0
bool FileUtilProxy::Touch( scoped_refptr<MessageLoopProxy> message_loop_proxy, const FilePath& file_path, const base::Time& last_access_time, const base::Time& last_modified_time, StatusCallback* callback) { return Start(FROM_HERE, message_loop_proxy, new RelayTouchFilePath(file_path, last_access_time, last_modified_time, callback)); }
2,893
87,811
0
R_API int r_core_cmd_buffer(RCore *core, const char *buf) { char *ptr, *optr, *str = strdup (buf); if (!str) { return false; } optr = str; ptr = strchr (str, '\n'); while (ptr) { *ptr = '\0'; r_core_cmd (core, optr, 0); optr = ptr + 1; ptr = strchr (str, '\n'); } r_core_cmd (core, optr, 0); free (str); return true; }
2,894
20,755
0
void kvm_complete_insn_gp(struct kvm_vcpu *vcpu, int err) { if (err) kvm_inject_gp(vcpu, 0); else kvm_x86_ops->skip_emulated_instruction(vcpu); }
2,895
158,445
0
void SendScrollBeginAckIfNeeded(InputEventAckState ack_result) { MockWidgetInputHandler::MessageVector events = GetAndResetDispatchedMessages(); SendScrollBeginAckIfNeeded(events, ack_result); }
2,896
152,789
0
NGConstraintSpace NGColumnLayoutAlgorithm::CreateConstraintSpaceForBalancing( const LogicalSize& column_size) const { NGConstraintSpaceBuilder space_builder( ConstraintSpace(), Style().GetWritingMode(), /* is_new_fc */ true); space_builder.SetAvailableSize({column_size.inline_size, kIndefiniteSize}); space_builder.SetPercentageResolutionSize(column_size); space_builder.SetIsAnonymous(true); space_builder.SetIsIntermediateLayout(true); return space_builder.ToConstraintSpace(); }
2,897
18,925
0
static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) { struct sockaddr_in sin; const struct iphdr *iph = ip_hdr(skb); __be16 *ports = (__be16 *)skb_transport_header(skb); if (skb_transport_offset(skb) + 4 > skb->len) return; /* All current transport protocols have the port numbers in the * first four bytes of the transport header and this function is * written with this assumption in mind. */ sin.sin_family = AF_INET; sin.sin_addr.s_addr = iph->daddr; sin.sin_port = ports[1]; memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); put_cmsg(msg, SOL_IP, IP_ORIGDSTADDR, sizeof(sin), &sin); }
2,898
58,400
0
static int global_template_search(const char *key, void *data, void *privdata) { template_iter_t *iter = privdata; default_template_t *def_t = data; if (def_t->flags == iter->level) iter->res = key; return 0; }
2,899