unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
49,803
0
static void arcmsr_hbaD_start_bgrb(struct AdapterControlBlock *pACB) { struct MessageUnit_D *pmu = pACB->pmuD; pACB->acb_flags |= ACB_F_MSG_START_BGRB; writel(ARCMSR_INBOUND_MESG0_START_BGRB, pmu->inbound_msgaddr0); if (!arcmsr_hbaD_wait_msgint_ready(pACB)) { pr_notice("arcmsr%d: wait 'start adapter " "background rebulid' timeout\n", pACB->host->host_no); } }
14,200
156,199
0
IdleTimeEstimator* RendererSchedulerImpl::GetIdleTimeEstimatorForTesting() { return &main_thread_only().idle_time_estimator; }
14,201
159,921
0
gfx::Image CreateBitmap(SkColor color) { SkBitmap thumbnail; thumbnail.allocN32Pixels(4, 4); thumbnail.eraseColor(color); return gfx::Image::CreateFrom1xBitmap(thumbnail); // adds ref. }
14,202
58,702
0
SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) { struct kioctx *ioctx = NULL; unsigned long ctx; long ret; ret = get_user(ctx, ctxp); if (unlikely(ret)) goto out; ret = -EINVAL; if (unlikely(ctx || nr_events == 0)) { pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n", ctx, nr_events); goto out; } ioctx = ioctx_alloc(nr_events); ret = PTR_ERR(ioctx); if (!IS_ERR(ioctx)) { ret = put_user(ioctx->user_id, ctxp); if (ret) io_destroy(ioctx); put_ioctx(ioctx); } out: return ret; }
14,203
78,531
0
auth_check_sw(struct sc_card *card, unsigned int sw1, unsigned int sw2) { int ii; for (ii=0; auth_warnings[ii].SWs; ii++) { if (auth_warnings[ii].SWs == ((sw1 << 8) | sw2)) { sc_log(card->ctx, "%s", auth_warnings[ii].errorstr); return auth_warnings[ii].errorno; } } return iso_ops->check_sw(card, sw1, sw2); }
14,204
74,317
0
static bool send_client_authreq(PgSocket *client) { uint8_t saltlen = 0; int res; int auth = cf_auth_type; uint8_t randbuf[2]; if (auth == AUTH_CRYPT) { saltlen = 2; get_random_bytes(randbuf, saltlen); client->tmp_login_salt[0] = valid_crypt_salt[randbuf[0] & SALT_MASK]; client->tmp_login_salt[1] = valid_crypt_salt[randbuf[1] & SALT_MASK]; client->tmp_login_salt[2] = 0; } else if (cf_auth_type == AUTH_MD5) { saltlen = 4; get_random_bytes((void*)client->tmp_login_salt, saltlen); } else if (auth == AUTH_ANY) auth = AUTH_TRUST; SEND_generic(res, client, 'R', "ib", auth, client->tmp_login_salt, saltlen); return res; }
14,205
115,386
0
void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef*, const void *clientInfo) { static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFailLoadWithErrorForFrame(frame, error); }
14,206
119,896
0
void FrameLoader::didLayout(LayoutMilestones milestones) { m_client->dispatchDidLayout(milestones); }
14,207
159,764
0
bool PermissionsBubbleDialogDelegateView::Close() { return true; }
14,208
164,336
0
ExtensionFunction::ResponseAction WindowsGetFunction::Run() { std::unique_ptr<windows::Get::Params> params( windows::Get::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); ApiParameterExtractor<windows::Get::Params> extractor(params.get()); Browser* browser = nullptr; std::string error; if (!windows_util::GetBrowserFromWindowID(this, params->window_id, extractor.type_filters(), &browser, &error)) { return RespondNow(Error(error)); } ExtensionTabUtil::PopulateTabBehavior populate_tab_behavior = extractor.populate_tabs() ? ExtensionTabUtil::kPopulateTabs : ExtensionTabUtil::kDontPopulateTabs; std::unique_ptr<base::DictionaryValue> windows = ExtensionTabUtil::CreateWindowValueForExtension(*browser, extension(), populate_tab_behavior); return RespondNow(OneArgument(std::move(windows))); }
14,209
42,275
0
sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) { sg_io_hdr_t *hp = &srp->header; int err = 0, err2; int len; if (count < SZ_SG_IO_HDR) { err = -EINVAL; goto err_out; } hp->sb_len_wr = 0; if ((hp->mx_sb_len > 0) && hp->sbp) { if ((CHECK_CONDITION & hp->masked_status) || (DRIVER_SENSE & hp->driver_status)) { int sb_len = SCSI_SENSE_BUFFERSIZE; sb_len = (hp->mx_sb_len > sb_len) ? sb_len : hp->mx_sb_len; len = 8 + (int) srp->sense_b[7]; /* Additional sense length field */ len = (len > sb_len) ? sb_len : len; if (copy_to_user(hp->sbp, srp->sense_b, len)) { err = -EFAULT; goto err_out; } hp->sb_len_wr = len; } } if (hp->masked_status || hp->host_status || hp->driver_status) hp->info |= SG_INFO_CHECK; if (copy_to_user(buf, hp, SZ_SG_IO_HDR)) { err = -EFAULT; goto err_out; } err_out: err2 = sg_finish_rem_req(srp); return err ? : err2 ? : count; }
14,210
71,940
0
static int ModuleCompare(const void *x,const void *y) { register const char **p, **q; p=(const char **) x; q=(const char **) y; return(LocaleCompare(*p,*q)); }
14,211
182,627
1
static void bt_for_each(struct blk_mq_hw_ctx *hctx, struct blk_mq_bitmap_tags *bt, unsigned int off, busy_iter_fn *fn, void *data, bool reserved) { struct request *rq; int bit, i; for (i = 0; i < bt->map_nr; i++) { struct blk_align_bitmap *bm = &bt->map[i]; for (bit = find_first_bit(&bm->word, bm->depth); bit < bm->depth; bit = find_next_bit(&bm->word, bm->depth, bit + 1)) { rq = blk_mq_tag_to_rq(hctx->tags, off + bit); if (rq->q == hctx->queue) fn(hctx, rq, data, reserved); } off += (1 << bt->bits_per_word); } }
14,212
148,443
0
void WebContentsImpl::LostMouseLock(RenderWidgetHostImpl* render_widget_host) { CHECK(mouse_lock_widget_); if (mouse_lock_widget_->delegate()->GetAsWebContents() != this) return mouse_lock_widget_->delegate()->LostMouseLock(render_widget_host); mouse_lock_widget_->SendMouseLockLost(); for (WebContentsImpl* current = this; current; current = current->GetOuterWebContents()) { current->mouse_lock_widget_ = nullptr; } if (delegate_) delegate_->LostMouseLock(); }
14,213
172,895
0
void do_enable(char UNUSED *p) { bdt_enable(); }
14,214
75,282
0
static void *make_block_array(void *mem, int count, int size) { int i; void ** p = (void **) mem; char *q = (char *) (p + count); for (i=0; i < count; ++i) { p[i] = q; q += size; } return p; }
14,215
67,748
0
void r_pkcs7_free_extendedcertificatesandcertificates (RPKCS7ExtendedCertificatesAndCertificates *ecac) { ut32 i; if (ecac) { for (i = 0; i < ecac->length; ++i) { r_x509_free_certificate (ecac->elements[i]); ecac->elements[i] = NULL; } R_FREE (ecac->elements); } }
14,216
158,740
0
bool GLES2DecoderImpl::IsDrawValid( const char* function_name, GLuint max_vertex_accessed, bool instanced, GLsizei primcount) { DCHECK(instanced || primcount == 1); if (!state_.current_program.get()) { LOCAL_RENDER_WARNING("Drawing with no current shader program."); return false; } if (!feature_info_->feature_flags().separate_stencil_ref_mask_writemask) { if (!ValidateStencilStateForDraw(function_name)) { return false; } } if (CheckDrawingFeedbackLoops()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, function_name, "Source and destination textures of the draw are the same."); return false; } if (!state_.vertex_attrib_manager->ValidateBindings( function_name, this, feature_info_.get(), buffer_manager(), state_.current_program.get(), max_vertex_accessed, instanced, primcount)) { return false; } if (workarounds().disallow_large_instanced_draw) { const GLsizei kMaxInstancedDrawPrimitiveCount = 0x4000000; if (primcount > kMaxInstancedDrawPrimitiveCount) { LOCAL_SET_GL_ERROR( GL_OUT_OF_MEMORY, function_name, "Instanced draw primcount too large for this platform"); return false; } } return true; }
14,217
116,092
0
void SyncManager::SyncInternal::OnIPAddressChangedImpl() { DCHECK(thread_checker_.CalledOnValidThread()); if (scheduler()) scheduler()->OnConnectionStatusChange(); }
14,218
186,941
1
InlineBoxPosition ComputeInlineBoxPositionTemplate( const PositionTemplate<Strategy>& position, TextAffinity affinity, TextDirection primary_direction) { int caret_offset = position.ComputeEditingOffset(); Node* const anchor_node = position.AnchorNode(); LayoutObject* layout_object = anchor_node->IsShadowRoot() ? ToShadowRoot(anchor_node)->host().GetLayoutObject() : anchor_node->GetLayoutObject(); DCHECK(layout_object) << position; if (layout_object->IsText()) { return ComputeInlineBoxPositionForTextNode(layout_object, caret_offset, affinity, primary_direction); } if (layout_object->IsLayoutBlockFlow()) { if (CanHaveChildrenForEditing(anchor_node) && HasRenderedNonAnonymousDescendantsWithHeight(layout_object)) { // Try a visually equivalent position with possibly opposite // editability. This helps in case |this| is in an editable block // but surrounded by non-editable positions. It acts to negate the // logic at the beginning of // |LayoutObject::createPositionWithAffinity()|. const PositionTemplate<Strategy>& downstream_equivalent = DownstreamIgnoringEditingBoundaries(position); if (downstream_equivalent != position) { return ComputeInlineBoxPosition( downstream_equivalent, TextAffinity::kUpstream, primary_direction); } const PositionTemplate<Strategy>& upstream_equivalent = UpstreamIgnoringEditingBoundaries(position); if (upstream_equivalent == position || DownstreamIgnoringEditingBoundaries(upstream_equivalent) == position) return InlineBoxPosition(); return ComputeInlineBoxPosition( upstream_equivalent, TextAffinity::kUpstream, primary_direction); } // We can't return null here because atomic inlines can also be block flows, // e.g., LayoutTextControl. // TODO(xiaochengh): Move atomic inline handling before block flow handling // so that we can directly return null here. } if (!layout_object->IsAtomicInlineLevel()) return InlineBoxPosition(); if (!layout_object->IsBox()) return InlineBoxPosition(); InlineBox* const inline_box = ToLayoutBox(layout_object)->InlineBoxWrapper(); if (!inline_box) return InlineBoxPosition(); if ((caret_offset > inline_box->CaretMinOffset() && caret_offset < inline_box->CaretMaxOffset())) return InlineBoxPosition(inline_box, caret_offset); return AdjustInlineBoxPositionForTextDirection( inline_box, caret_offset, layout_object->Style()->GetUnicodeBidi(), primary_direction); }
14,219
26,517
0
static int pmcraid_setup_chrdev(struct pmcraid_instance *pinstance) { int minor; int error; minor = pmcraid_get_minor(); cdev_init(&pinstance->cdev, &pmcraid_fops); pinstance->cdev.owner = THIS_MODULE; error = cdev_add(&pinstance->cdev, MKDEV(pmcraid_major, minor), 1); if (error) pmcraid_release_minor(minor); else device_create(pmcraid_class, NULL, MKDEV(pmcraid_major, minor), NULL, "%s%u", PMCRAID_DEVFILE, minor); return error; }
14,220
109,760
0
void Document::processBaseElement() { const AtomicString* href = 0; const AtomicString* target = 0; for (Element* element = ElementTraversal::firstWithin(this); element && (!href || !target); element = ElementTraversal::next(element)) { if (element->hasTagName(baseTag)) { if (!href) { const AtomicString& value = element->fastGetAttribute(hrefAttr); if (!value.isNull()) href = &value; } if (!target) { const AtomicString& value = element->fastGetAttribute(targetAttr); if (!value.isNull()) target = &value; } if (contentSecurityPolicy()->isActive()) UseCounter::count(*this, UseCounter::ContentSecurityPolicyWithBaseElement); } } KURL baseElementURL; if (href) { String strippedHref = stripLeadingAndTrailingHTMLSpaces(*href); if (!strippedHref.isEmpty()) baseElementURL = KURL(url(), strippedHref); } if (m_baseElementURL != baseElementURL && contentSecurityPolicy()->allowBaseURI(baseElementURL)) { m_baseElementURL = baseElementURL; updateBaseURL(); } m_baseTarget = target ? *target : nullAtom; }
14,221
8,754
0
void FAST_FUNC udhcp_add_binary_option(struct dhcp_packet *packet, uint8_t *addopt) { unsigned len; uint8_t *optionptr = packet->options; unsigned end = udhcp_end_option(optionptr); len = OPT_DATA + addopt[OPT_LEN]; /* end position + (option code/length + addopt length) + end option */ if (end + len + 1 >= DHCP_OPTIONS_BUFSIZE) { bb_error_msg("option 0x%02x did not fit into the packet", addopt[OPT_CODE]); return; } log_option("adding option", addopt); memcpy(optionptr + end, addopt, len); optionptr[end + len] = DHCP_END; }
14,222
12,905
0
struct nl_msg *nlmsg_alloc_size(size_t max) { return __nlmsg_alloc(max); }
14,223
115,672
0
ClientSessionTest() {}
14,224
8,416
0
pvscsi_init_msi(PVSCSIState *s) { int res; PCIDevice *d = PCI_DEVICE(s); res = msi_init(d, PVSCSI_MSI_OFFSET(s), PVSCSI_MSIX_NUM_VECTORS, PVSCSI_USE_64BIT, PVSCSI_PER_VECTOR_MASK, NULL); if (res < 0) { trace_pvscsi_init_msi_fail(res); s->msi_used = false; } else { s->msi_used = true; } }
14,225
180,231
1
SPL_METHOD(SplFileObject, getMaxLineLen) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_LONG((long)intern->u.file.max_line_len); } /* }}} */ /* {{{ proto bool SplFileObject::hasChildren()
14,226
178,769
1
i915_gem_execbuffer2(struct drm_device *dev, void *data, struct drm_file *file) { struct drm_i915_gem_execbuffer2 *args = data; struct drm_i915_gem_exec_object2 *exec2_list = NULL; int ret; if (args->buffer_count < 1) { DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); return -EINVAL; } exec2_list = kmalloc(sizeof(*exec2_list)*args->buffer_count, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); if (exec2_list == NULL) exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); if (exec2_list == NULL) { DRM_DEBUG("Failed to allocate exec list for %d buffers\n", args->buffer_count); return -ENOMEM; } ret = copy_from_user(exec2_list, (struct drm_i915_relocation_entry __user *) (uintptr_t) args->buffers_ptr, sizeof(*exec2_list) * args->buffer_count); if (ret != 0) { DRM_DEBUG("copy %d exec entries failed %d\n", args->buffer_count, ret); drm_free_large(exec2_list); return -EFAULT; } ret = i915_gem_do_execbuffer(dev, data, file, args, exec2_list); if (!ret) { /* Copy the new buffer offsets back to the user's exec list. */ ret = copy_to_user((struct drm_i915_relocation_entry __user *) (uintptr_t) args->buffers_ptr, exec2_list, sizeof(*exec2_list) * args->buffer_count); if (ret) { ret = -EFAULT; DRM_DEBUG("failed to copy %d exec entries " "back to user (%d)\n", args->buffer_count, ret); } } drm_free_large(exec2_list); return ret; }
14,227
114,176
0
void ChromeContentClient::SetGpuInfo(const content::GPUInfo& gpu_info) { child_process_logging::SetGpuInfo(gpu_info); }
14,228
80,539
0
void tkhd_del(GF_Box *s) { GF_TrackHeaderBox *ptr = (GF_TrackHeaderBox *)s; if (ptr == NULL) return; gf_free(ptr); return; }
14,229
139,583
0
void RenderMediaClient::RecordRapporURL(const std::string& metric, const GURL& url) { GetContentClient()->renderer()->RecordRapporURL(metric, url); }
14,230
50,388
0
posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl, void *buffer, size_t size) { posix_acl_xattr_header *ext_acl = (posix_acl_xattr_header *)buffer; posix_acl_xattr_entry *ext_entry; int real_size, n; real_size = posix_acl_xattr_size(acl->a_count); if (!buffer) return real_size; if (real_size > size) return -ERANGE; ext_entry = ext_acl->a_entries; ext_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION); for (n=0; n < acl->a_count; n++, ext_entry++) { const struct posix_acl_entry *acl_e = &acl->a_entries[n]; ext_entry->e_tag = cpu_to_le16(acl_e->e_tag); ext_entry->e_perm = cpu_to_le16(acl_e->e_perm); switch(acl_e->e_tag) { case ACL_USER: ext_entry->e_id = cpu_to_le32(from_kuid(user_ns, acl_e->e_uid)); break; case ACL_GROUP: ext_entry->e_id = cpu_to_le32(from_kgid(user_ns, acl_e->e_gid)); break; default: ext_entry->e_id = cpu_to_le32(ACL_UNDEFINED_ID); break; } } return real_size; }
14,231
178,301
1
fbOver (CARD32 x, CARD32 y) { PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); CARD32 fbOver (CARD32 x, CARD32 y) { CARD16 a = ~x >> 24; CARD16 t; CARD32 m,n,o,p; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); o = FbOverU(x,y,16,a,t); p = FbOverU(x,y,24,a,t); return m|n|o|p; } CARD32 fbOver24 (CARD32 x, CARD32 y) { CARD16 a = ~x >> 24; CARD16 t; CARD32 m,n,o; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); o = FbOverU(x,y,16,a,t); return m|n|o; } CARD32 fbIn (CARD32 x, CARD8 y) { CARD16 a = y; CARD16 t; CARD32 m,n,o,p; m = FbInU(x,0,a,t); n = FbInU(x,8,a,t); o = FbInU(x,16,a,t); p = FbInU(x,24,a,t); return m|n|o|p; } #define genericCombine24(a,b,c,d) (((a)*(c)+(b)*(d))) /* * This macro does src IN mask OVER dst when src and dst are 0888. * If src has alpha, this will not work */ #define inOver0888(alpha, source, destval, dest) { \ CARD32 dstrb=destval&0xFF00FF; CARD32 dstag=(destval>>8)&0xFF00FF; \ CARD32 drb=((source&0xFF00FF)-dstrb)*alpha; CARD32 dag=(((source>>8)&0xFF00FF)-dstag)*alpha; \ WRITE(dest, ((((drb>>8) + dstrb) & 0x00FF00FF) | ((((dag>>8) + dstag) << 8) & 0xFF00FF00))); \ } /* * This macro does src IN mask OVER dst when src and dst are 0565 and * mask is a 5-bit alpha value. Again, if src has alpha, this will not * work. */ #define inOver0565(alpha, source, destval, dest) { \ CARD16 dstrb = destval & 0xf81f; CARD16 dstg = destval & 0x7e0; \ CARD32 drb = ((source&0xf81f)-dstrb)*alpha; CARD32 dg=((source & 0x7e0)-dstg)*alpha; \ WRITE(dest, ((((drb>>5) + dstrb)&0xf81f) | (((dg>>5) + dstg) & 0x7e0))); \ } #define inOver2x0565(alpha, source, destval, dest) { \ CARD32 dstrb = destval & 0x07e0f81f; CARD32 dstg = (destval & 0xf81f07e0)>>5; \ CARD32 drb = ((source&0x07e0f81f)-dstrb)*alpha; CARD32 dg=(((source & 0xf81f07e0)>>5)-dstg)*alpha; \ WRITE(dest, ((((drb>>5) + dstrb)&0x07e0f81f) | ((((dg>>5) + dstg)<<5) & 0xf81f07e0))); \ } #if IMAGE_BYTE_ORDER == LSBFirst #define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(long)where; \ temp=count&3; \ where-=temp; \ workingWhere=(CARD32 *)where; \ workingVal=READ(workingWhere++); \ count=4-temp; \ workingVal>>=(8*temp) #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y = READ(z++); } where=(y)&0xff; (y)>>=8; (x)--;} #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) #define writePacked(what) workingoDest>>=8; workingoDest|=(what<<24); ww--; if(!ww) { ww=4; WRITE (wodst++, workingoDest); } #else #warning "I havn't tested fbCompositeTrans_0888xnx0888() on big endian yet!" #define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(long)where; \ temp=count&3; \ where-=temp; \ workingWhere=(CARD32 *)where; \ workingVal=READ(workingWhere++); \ count=4-temp; \ workingVal<<=(8*temp) #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y = READ(z++); } where=(y)>>24; (y)<<=8; (x)--;} #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) #define writePacked(what) workingoDest<<=8; workingoDest|=what; ww--; if(!ww) { ww=4; WRITE(wodst++, workingoDest); } #endif /* * Naming convention: * * opSRCxMASKxDST */ void fbCompositeSolidMask_nx8x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; fbComposeGetSolid(pSrc, src, pDst->format); dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = READ(mask++); if (m == 0xff) { if (srca == 0xff) WRITE(dst, src & dstMask); else WRITE(dst, fbOver (src, READ(dst)) & dstMask); } else if (m) { d = fbIn (src, m); WRITE(dst, fbOver (d, READ(dst)) & dstMask); } dst++; } } fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } void fbCompositeSolidMask_nx8888x8888C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD32 *dstLine, *dst, d, dstMask; CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; CARD16 w; CARD32 m, n, o, p; fbComposeGetSolid(pSrc, src, pDst->format); dstMask = FbFullMask (pDst->pDrawable->depth); srca = src >> 24; if (src == 0) return; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { ma = READ(mask++); if (ma == 0xffffffff) { if (srca == 0xff) WRITE(dst, src & dstMask); else WRITE(dst, fbOver (src, READ(dst)) & dstMask); } else if (ma) { d = READ(dst); #define FbInOverC(src,srca,msk,dst,i,result) { \ CARD16 __a = FbGet8(msk,i); \ CARD32 __t, __ta; \ CARD32 __i; \ __t = FbIntMult (FbGet8(src,i), __a,__i); \ __ta = (CARD8) ~FbIntMult (srca, __a,__i); \ __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ result = __t << (i); \ } FbInOverC (src, srca, ma, d, 0, m); FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); FbInOverC (src, srca, ma, d, 24, p); WRITE(dst, m|n|o|p); } dst++; } } fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } #define srcAlphaCombine24(a,b) genericCombine24(a,b,srca,srcia) void fbCompositeSolidMask_nx8x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca, srcia; CARD8 *dstLine, *dst, *edst; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w; CARD32 rs,gs,bs,rd,gd,bd; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; srcia = 255-srca; if (src == 0) return; rs=src&0xff; gs=(src>>8)&0xff; bs=(src>>16)&0xff; fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { /* fixme: cleanup unused */ unsigned long wt, wd; CARD32 workingiDest; CARD32 *widst; edst = dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; #ifndef NO_MASKED_PACKED_READ setupPackedReader(wd,wt,edst,widst,workingiDest); #endif while (w--) { #ifndef NO_MASKED_PACKED_READ readPackedDest(rd); readPackedDest(gd); readPackedDest(bd); #else rd = READ(edst++); gd = READ(edst++); bd = READ(edst++); #endif m = READ(mask++); if (m == 0xff) { if (srca == 0xff) { WRITE(dst++, rs); WRITE(dst++, gs); WRITE(dst++, bs); } else { WRITE(dst++, (srcAlphaCombine24(rs, rd)>>8)); WRITE(dst++, (srcAlphaCombine24(gs, gd)>>8)); WRITE(dst++, (srcAlphaCombine24(bs, bd)>>8)); } } else if (m) { int na=(srca*(int)m)>>8; int nia=255-na; WRITE(dst++, (genericCombine24(rs, rd, na, nia)>>8)); WRITE(dst++, (genericCombine24(gs, gd, na, nia)>>8)); WRITE(dst++, (genericCombine24(bs, bd, na, nia)>>8)); } else { dst+=3; } } } fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } void fbCompositeSolidMask_nx8x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca8, srca5; CARD16 *dstLine, *dst; CARD16 d; CARD32 t; CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; CARD16 w,src16; fbComposeGetSolid(pSrc, src, pDst->format); if (src == 0) return; srca8 = (src >> 24); srca5 = (srca8 >> 3); src16 = cvt8888to0565(src); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = READ(mask++); if (m == 0) dst++; else if (srca5 == (0xff >> 3)) { if (m == 0xff) WRITE(dst++, src16); else { d = READ(dst); m >>= 3; inOver0565 (m, src16, d, dst++); } } else { d = READ(dst); if (m == 0xff) { t = fbOver24 (src, cvt0565to0888 (d)); } else { t = fbIn (src, m); t = fbOver (t, cvt0565to0888 (d)); } WRITE(dst++, cvt8888to0565 (t)); } } } fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } static void fbCompositeSolidMask_nx8888x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca8, srca5; CARD16 *dstLine, *dst; CARD16 d; CARD32 *maskLine, *mask; CARD32 t; CARD8 m; FbStride dstStride, maskStride; CARD16 w, src16; fbComposeGetSolid(pSrc, src, pDst->format); if (src == 0) return; srca8 = src >> 24; srca5 = srca8 >> 3; src16 = cvt8888to0565(src); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { m = READ(mask++) >> 24; if (m == 0) dst++; else if (srca5 == (0xff >> 3)) { if (m == 0xff) WRITE(dst++, src16); else { d = READ(dst); m >>= 3; inOver0565 (m, src16, d, dst++); } } else { if (m == 0xff) { d = READ(dst); t = fbOver24 (src, cvt0565to0888 (d)); WRITE(dst++, cvt8888to0565 (t)); } else { d = READ(dst); t = fbIn (src, m); t = fbOver (t, cvt0565to0888 (d)); WRITE(dst++, cvt8888to0565 (t)); } } } } } void fbCompositeSolidMask_nx8888x0565C (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 src, srca; CARD16 src16; CARD16 *dstLine, *dst; CARD32 d; CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; CARD16 w; CARD32 m, n, o; fbComposeGetSolid(pSrc, src, pDst->format); srca = src >> 24; if (src == 0) return; src16 = cvt8888to0565(src); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { ma = READ(mask++); if (ma == 0xffffffff) { if (srca == 0xff) { WRITE(dst, src16); } else { d = READ(dst); d = fbOver24 (src, cvt0565to0888(d)); WRITE(dst, cvt8888to0565(d)); } } else if (ma) { d = READ(dst); d = cvt0565to0888(d); FbInOverC (src, srca, ma, d, 0, m); FbInOverC (src, srca, ma, d, 8, n); FbInOverC (src, srca, ma, d, 16, o); d = m|n|o; WRITE(dst, cvt8888to0565(d)); } dst++; } } fbFinishAccess (pMask->pDrawable); fbFinishAccess (pDst->pDrawable); } void fbCompositeSrc_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 *dstLine, *dst, dstMask; CARD32 *srcLine, *src, s; FbStride dstStride, srcStride; CARD8 a; CARD16 w; fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); dstMask = FbFullMask (pDst->pDrawable->depth); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = READ(src++); a = s >> 24; if (a == 0xff) WRITE(dst, s & dstMask); else if (a) WRITE(dst, fbOver (s, READ(dst)) & dstMask); dst++; } } fbFinishAccess (pSrc->pDrawable); fbFinishAccess (pDst->pDrawable); } void fbCompositeSrc_8888x0888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst; CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; FbStride dstStride, srcStride; CARD16 w; fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = READ(src++); a = s >> 24; if (a) { if (a == 0xff) d = s; else d = fbOver24 (s, Fetch24(dst)); Store24(dst,d); } dst += 3; } } fbFinishAccess (pSrc->pDrawable); fbFinishAccess (pDst->pDrawable); } void fbCompositeSrc_8888x0565 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD16 *dstLine, *dst; CARD32 d; CARD32 *srcLine, *src, s; CARD8 a; FbStride dstStride, srcStride; CARD16 w; fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = READ(src++); a = s >> 24; if (a) { if (a == 0xff) d = s; else { d = READ(dst); d = fbOver24 (s, cvt0565to0888(d)); } WRITE(dst, cvt8888to0565(d)); } dst++; } } fbFinishAccess (pDst->pDrawable); fbFinishAccess (pSrc->pDrawable); } void fbCompositeSrcAdd_8000x8000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst; CARD8 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; CARD8 s, d; CARD16 t; fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = READ(src++); if (s) { if (s != 0xff) { d = READ(dst); t = d + s; s = t | (0 - (t >> 8)); } WRITE(dst, s); } dst++; } } fbFinishAccess (pDst->pDrawable); fbFinishAccess (pSrc->pDrawable); } void fbCompositeSrcAdd_8888x8888 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 *dstLine, *dst; CARD32 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; CARD32 s, d; CARD16 t; CARD32 m,n,o,p; fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); while (height--) { dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; while (w--) { s = READ(src++); if (s) { if (s != 0xffffffff) { d = READ(dst); if (d) { m = FbAdd(s,d,0,t); n = FbAdd(s,d,8,t); o = FbAdd(s,d,16,t); p = FbAdd(s,d,24,t); s = m|n|o|p; } } WRITE(dst, s); } dst++; } } fbFinishAccess (pDst->pDrawable); fbFinishAccess (pSrc->pDrawable); } static void fbCompositeSrcAdd_8888x8x8 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst; CARD8 *maskLine, *mask; FbStride dstStride, maskStride; CARD16 w; CARD32 src; CARD8 sa; fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); fbComposeGetSolid (pSrc, src, pDst->format); sa = (src >> 24); while (height--) { dst = dstLine; dstLine += dstStride; mask = maskLine; maskLine += maskStride; w = width; while (w--) { CARD16 tmp; CARD16 a; CARD32 m, d; CARD32 r; a = READ(mask++); d = READ(dst); m = FbInU (sa, 0, a, tmp); r = FbAdd (m, d, 0, tmp); WRITE(dst++, r); } } fbFinishAccess(pDst->pDrawable); fbFinishAccess(pMask->pDrawable); } void fbCompositeSrcAdd_1000x1000 (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; int dstBpp, srcBpp; int dstXoff, dstYoff; int srcXoff, srcYoff; fbGetDrawable(pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); fbGetDrawable(pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, xSrc + srcXoff, dstBits + dstStride * (yDst + dstYoff), dstStride, xDst + dstXoff, width, height, GXor, FB_ALLONES, srcBpp, FALSE, FALSE); fbFinishAccess(pDst->pDrawable); fbFinishAccess(pSrc->pDrawable); } void fbCompositeSolidMask_nx1xn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { FbBits *dstBits; FbStip *maskBits; FbStride dstStride, maskStride; int dstBpp, maskBpp; int dstXoff, dstYoff; int maskXoff, maskYoff; FbBits src; fbComposeGetSolid(pSrc, src, pDst->format); fbGetStipDrawable (pMask->pDrawable, maskBits, maskStride, maskBpp, maskXoff, maskYoff); fbGetDrawable (pDst->pDrawable, dstBits, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 32: break; case 24: break; case 16: src = cvt8888to0565(src); break; } src = fbReplicatePixel (src, dstBpp); fbBltOne (maskBits + maskStride * (yMask + maskYoff), maskStride, xMask + maskXoff, dstBits + dstStride * (yDst + dstYoff), dstStride, (xDst + dstXoff) * dstBpp, dstBpp, width * dstBpp, height, 0x0, src, FB_ALLONES, 0x0); fbFinishAccess (pDst->pDrawable); fbFinishAccess (pMask->pDrawable); } # define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) /* * Apply a constant alpha value in an over computation */ static void fbCompositeSrcSrc_nxn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); static void fbCompositeTrans_0565xnx0565(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD16 *dstLine, *dst; CARD16 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; FbBits mask; CARD8 maskAlpha; CARD16 s_16, d_16; CARD32 s_32, d_32; fbComposeGetSolid (pMask, mask, pDst->format); maskAlpha = mask >> 27; if (!maskAlpha) return; if (maskAlpha == 0xff) { fbCompositeSrcSrc_nxn (PictOpSrc, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); return; } fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { CARD32 *isrc, *idst; dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width; if(((long)src&1)==1) { s_16 = READ(src++); d_16 = READ(dst); inOver0565(maskAlpha, s_16, d_16, dst++); w--; } isrc=(CARD32 *)src; if(((long)dst&1)==0) { idst=(CARD32 *)dst; while (w>1) { s_32 = READ(isrc++); d_32 = READ(idst); inOver2x0565(maskAlpha, s_32, d_32, idst++); w-=2; } dst=(CARD16 *)idst; } else { while (w > 1) { s_32 = READ(isrc++); #if IMAGE_BYTE_ORDER == LSBFirst s_16=s_32&0xffff; #else s_16=s_32>>16; #endif d_16 = READ(dst); inOver0565 (maskAlpha, s_16, d_16, dst++); #if IMAGE_BYTE_ORDER == LSBFirst s_16=s_32>>16; #else s_16=s_32&0xffff; #endif d_16 = READ(dst); inOver0565(maskAlpha, s_16, d_16, dst++); w-=2; } } src=(CARD16 *)isrc; if(w!=0) { s_16 = READ(src); d_16 = READ(dst); inOver0565(maskAlpha, s_16, d_16, dst); } } fbFinishAccess (pSrc->pDrawable); fbFinishAccess (pDst->pDrawable); } /* macros for "i can't believe it's not fast" packed pixel handling */ #define alphamaskCombine24(a,b) genericCombine24(a,b,maskAlpha,maskiAlpha) static void fbCompositeTrans_0888xnx0888(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD8 *dstLine, *dst,*idst; CARD8 *srcLine, *src; FbStride dstStride, srcStride; CARD16 w; FbBits mask; CARD16 maskAlpha,maskiAlpha; fbComposeGetSolid (pMask, mask, pDst->format); maskAlpha = mask >> 24; maskiAlpha= 255-maskAlpha; if (!maskAlpha) return; /* if (maskAlpha == 0xff) { fbCompositeSrc_0888x0888 (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); return; } */ fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 3); fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); { unsigned long ws,wt; CARD32 workingSource; CARD32 *wsrc, *wdst, *widst; CARD32 rs, rd, nd; CARD8 *isrc; /* are xSrc and xDst at the same alignment? if not, we need to be complicated :) */ /* if(0==0) */ if ((((xSrc * 3) & 3) != ((xDst * 3) & 3)) || ((srcStride & 3) != (dstStride & 3))) { while (height--) { dst = dstLine; dstLine += dstStride; isrc = src = srcLine; srcLine += srcStride; w = width*3; setupPackedReader(ws,wt,isrc,wsrc,workingSource); /* get to word aligned */ switch(~(long)dst&3) { case 1: readPackedSource(rs); /* *dst++=alphamaskCombine24(rs, *dst)>>8; */ rd = READ(dst); /* make gcc happy. hope it doens't cost us too much performance*/ WRITE(dst++, alphamaskCombine24(rs, rd) >> 8); w--; if(w==0) break; case 2: readPackedSource(rs); rd = READ(dst); WRITE(dst++, alphamaskCombine24(rs, rd) >> 8); w--; if(w==0) break; case 3: readPackedSource(rs); rd = READ(dst); WRITE(dst++,alphamaskCombine24(rs, rd) >> 8); w--; if(w==0) break; } wdst=(CARD32 *)dst; while (w>3) { rs=READ(wsrc++); /* FIXME: write a special readPackedWord macro, which knows how to * halfword combine */ #if IMAGE_BYTE_ORDER == LSBFirst rd=READ(wdst); readPackedSource(nd); readPackedSource(rs); nd|=rs<<8; readPackedSource(rs); nd|=rs<<16; readPackedSource(rs); nd|=rs<<24; #else readPackedSource(nd); nd<<=24; readPackedSource(rs); nd|=rs<<16; readPackedSource(rs); nd|=rs<<8; readPackedSource(rs); nd|=rs; #endif inOver0888(maskAlpha, nd, rd, wdst++); w-=4; } src=(CARD8 *)wdst; switch(w) { case 3: readPackedSource(rs); rd=READ(dst); WRITE(dst++,alphamaskCombine24(rs, rd)>>8); case 2: readPackedSource(rs); rd = READ(dst); WRITE(dst++, alphamaskCombine24(rs, rd)>>8); case 1: readPackedSource(rs); rd = READ(dst); WRITE(dst++, alphamaskCombine24(rs, rd)>>8); } } } else { while (height--) { idst=dst = dstLine; dstLine += dstStride; src = srcLine; srcLine += srcStride; w = width*3; /* get to word aligned */ switch(~(long)src&3) { case 1: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); w--; if(w==0) break; case 2: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); w--; if(w==0) break; case 3: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); w--; if(w==0) break; } wsrc=(CARD32 *)src; widst=(CARD32 *)dst; while(w>3) { rs = READ(wsrc++); rd = READ(widst); inOver0888 (maskAlpha, rs, rd, widst++); w-=4; } src=(CARD8 *)wsrc; dst=(CARD8 *)widst; switch(w) { case 3: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); case 2: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); case 1: rd=alphamaskCombine24(READ(src++), READ(dst))>>8; WRITE(dst++, rd); } } } } } /* * Simple bitblt */ static void fbCompositeSrcSrc_nxn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { FbBits *dst; FbBits *src; FbStride dstStride, srcStride; int srcXoff, srcYoff; int dstXoff, dstYoff; int srcBpp; int dstBpp; Bool reverse = FALSE; Bool upsidedown = FALSE; fbGetDrawable(pSrc->pDrawable,src,srcStride,srcBpp,srcXoff,srcYoff); fbGetDrawable(pDst->pDrawable,dst,dstStride,dstBpp,dstXoff,dstYoff); fbBlt (src + (ySrc + srcYoff) * srcStride, srcStride, (xSrc + srcXoff) * srcBpp, dst + (yDst + dstYoff) * dstStride, dstStride, (xDst + dstXoff) * dstBpp, (width) * dstBpp, (height), GXcopy, FB_ALLONES, dstBpp, reverse, upsidedown); fbFinishAccess(pSrc->pDrawable); fbFinishAccess(pDst->pDrawable); } /* * Solid fill void fbCompositeSolidSrc_nxn (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { } */ #define SCANLINE_BUFFER_LENGTH 2048 static void fbCompositeRectWrapper (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH * 3]; CARD32 *scanline_buffer = _scanline_buffer; FbComposeData data; data.op = op; data.src = pSrc; data.mask = pMask; data.dest = pDst; data.xSrc = xSrc; data.ySrc = ySrc; data.xMask = xMask; } void fbComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: #ifdef USE_MMX if (fbHaveMMX()) func = fbCompositeSolidMask_nx8x8888mmx; else CARD16 width, CARD16 height) { RegionRec region; int n; BoxPtr pbox; CompositeFunc func = NULL; Bool srcRepeat = pSrc->pDrawable && pSrc->repeatType == RepeatNormal; Bool maskRepeat = FALSE; Bool srcTransform = pSrc->transform != 0; break; Bool srcAlphaMap = pSrc->alphaMap != 0; Bool maskAlphaMap = FALSE; Bool dstAlphaMap = pDst->alphaMap != 0; int x_msk, y_msk, x_src, y_src, x_dst, y_dst; int w, h, w_this, h_this; #ifdef USE_MMX static Bool mmx_setup = FALSE; func = fbCompositeSolidMask_nx8888x8888Cmmx; else #endif } #endif xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; if (pSrc->pDrawable) { xSrc += pSrc->pDrawable->x; ySrc += pSrc->pDrawable->y; } if (srcRepeat && srcTransform && pSrc->pDrawable->width == 1 && pSrc->pDrawable->height == 1) else if (pMask && pMask->pDrawable) { xMask += pMask->pDrawable->x; yMask += pMask->pDrawable->y; maskRepeat = pMask->repeatType == RepeatNormal; if (pMask->filter == PictFilterConvolution) } else { switch (pDst->format) { case PICT_r5g6b5: func = fbCompositeSolidMask_nx8888x0565; break; default: break; } } break; case PICT_a8b8g8r8: if (pMask->componentAlpha) { switch (pDst->format) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: #ifdef USE_MMX if (fbHaveMMX()) func = fbCompositeSolidMask_nx8888x8888Cmmx; else #endif func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_b5g6r5: #ifdef USE_MMX if (fbHaveMMX()) func = fbCompositeSolidMask_nx8888x0565Cmmx; else #endif func = fbCompositeSolidMask_nx8888x0565C; break; default: break; } } else { switch (pDst->format) { case PICT_b5g6r5: func = fbCompositeSolidMask_nx8888x0565; break; default: break; } } break; case PICT_a1: switch (pDst->format) { case PICT_r5g6b5: case PICT_b5g6r5: case PICT_r8g8b8: case PICT_b8g8r8: case PICT_a8r8g8b8: case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: { FbBits src; fbComposeGetSolid(pSrc, src, pDst->format); if ((src & 0xff000000) == 0xff000000) func = fbCompositeSolidMask_nx1xn; break; } default: break; } break; default: break; }
14,232
66,775
0
static int prof_7500_frontend_attach(struct dvb_usb_adapter *d) { u8 obuf[] = {7, 1}; d->fe_adap[0].fe = dvb_attach(stv0900_attach, &prof_7500_stv0900_config, &d->dev->i2c_adap, 0); if (d->fe_adap[0].fe == NULL) return -EIO; d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage; dw210x_op_rw(d->dev->udev, 0x8a, 0, 0, obuf, 2, DW210X_WRITE_MSG); info("Attached STV0900+STB6100A!"); return 0; }
14,233
16,764
0
static coroutine_fn int qcow2_co_flush_to_os(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; int ret; qemu_co_mutex_lock(&s->lock); ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } if (qcow2_need_accurate_refcounts(s)) { ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { qemu_co_mutex_unlock(&s->lock); return ret; } } qemu_co_mutex_unlock(&s->lock); return 0; }
14,234
172,605
0
status_t AudioFlinger::EffectModule::remove_effect_from_hal_l() { if ((mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_PRE_PROC || (mDescriptor.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_POST_PROC) { sp<ThreadBase> thread = mThread.promote(); if (thread != 0) { audio_stream_t *stream = thread->stream(); if (stream != NULL) { stream->remove_audio_effect(stream, mEffectInterface); } } } return NO_ERROR; }
14,235
150,152
0
bool ImageProcessorClient::CreateImageProcessor( const ImageProcessor::PortConfig& input_config, const ImageProcessor::PortConfig& output_config, size_t num_buffers) { DCHECK_CALLED_ON_VALID_THREAD(test_main_thread_checker_); base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); image_processor_client_thread_.task_runner()->PostTask( FROM_HERE, base::BindOnce(&ImageProcessorClient::CreateImageProcessorTask, base::Unretained(this), std::cref(input_config), std::cref(output_config), num_buffers, &done)); done.Wait(); if (!image_processor_) { LOG(ERROR) << "Failed to create ImageProcessor"; return false; } return true; }
14,236
26,716
0
static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) { if (info->user_ptr[0]) cfg80211_unlock_rdev(info->user_ptr[0]); if (info->user_ptr[1]) dev_put(info->user_ptr[1]); if (ops->internal_flags & NL80211_FLAG_NEED_RTNL) rtnl_unlock(); }
14,237
101,580
0
gfx::NativeWindow Browser::BrowserShowHtmlDialog( HtmlDialogUIDelegate* delegate, gfx::NativeWindow parent_window) { return window_->ShowHTMLDialog(delegate, parent_window); }
14,238
129,935
0
std::string GetBuildIDForModule(HMODULE module_handle) { GUID guid; DWORD age; win::PEImage(module_handle).GetDebugId(&guid, &age); const int kGUIDSize = 39; std::wstring build_id; int result = ::StringFromGUID2(guid, WriteInto(&build_id, kGUIDSize), kGUIDSize); if (result != kGUIDSize) return std::string(); RemoveChars(build_id, L"{}-", &build_id); build_id += StringPrintf(L"%d", age); return WideToUTF8(build_id); }
14,239
53,948
0
void *ndp_msg_payload_opts(struct ndp_msg *msg) { return msg->opts_start; }
14,240
77,763
0
CURLcode Curl_disconnect(struct Curl_easy *data, struct connectdata *conn, bool dead_connection) { if(!conn) return CURLE_OK; /* this is closed and fine already */ if(!data) { DEBUGF(infof(data, "DISCONNECT without easy handle, ignoring\n")); return CURLE_OK; } /* * If this connection isn't marked to force-close, leave it open if there * are other users of it */ if(CONN_INUSE(conn) && !dead_connection) { DEBUGF(infof(data, "Curl_disconnect when inuse: %zu\n", CONN_INUSE(conn))); return CURLE_OK; } conn->data = data; if(conn->dns_entry != NULL) { Curl_resolv_unlock(data, conn->dns_entry); conn->dns_entry = NULL; } Curl_hostcache_prune(data); /* kill old DNS cache entries */ #if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) /* Cleanup NTLM connection-related data */ Curl_http_ntlm_cleanup(conn); #endif if(conn->handler->disconnect) /* This is set if protocol-specific cleanups should be made */ conn->handler->disconnect(conn, dead_connection); /* unlink ourselves! */ infof(data, "Closing connection %ld\n", conn->connection_id); Curl_conncache_remove_conn(conn, TRUE); free_fixed_hostname(&conn->host); free_fixed_hostname(&conn->conn_to_host); free_fixed_hostname(&conn->http_proxy.host); free_fixed_hostname(&conn->socks_proxy.host); DEBUGASSERT(conn->data == data); /* this assumes that the pointer is still there after the connection was detected from the cache */ Curl_ssl_close(conn, FIRSTSOCKET); conn_free(conn); return CURLE_OK; }
14,241
144,222
0
void LockContentsView::SwapToBigUser(int user_index) { if (Shell::Get()->login_screen_controller()->IsAuthenticating()) return; DCHECK(users_list_); LoginUserView* view = users_list_->user_view_at(user_index); DCHECK(view); mojom::LoginUserInfoPtr previous_big_user = primary_big_view_->GetCurrentUser()->Clone(); mojom::LoginUserInfoPtr new_big_user = view->current_user()->Clone(); view->UpdateForUser(previous_big_user, true /*animate*/); primary_big_view_->UpdateForUser(new_big_user); LayoutAuth(primary_big_view_, nullptr, true /*animate*/); OnBigUserChanged(); }
14,242
1,434
0
static ssize_t get_xattr_names(const char *fname) { ssize_t list_len; int64 arg; if (!namebuf) { namebuf_len = 1024; namebuf = new_array(char, namebuf_len); if (!namebuf) out_of_memory("get_xattr_names"); } while (1) { /* The length returned includes all the '\0' terminators. */ list_len = sys_llistxattr(fname, namebuf, namebuf_len); if (list_len >= 0) { if ((size_t)list_len <= namebuf_len) break; } else if (errno == ENOTSUP) return 0; else if (errno != ERANGE) { arg = namebuf_len; got_error: rsyserr(FERROR_XFER, errno, "get_xattr_names: llistxattr(%s,%s) failed", full_fname(fname), big_num(arg)); return -1; } list_len = sys_llistxattr(fname, NULL, 0); if (list_len < 0) { arg = 0; goto got_error; } if (namebuf_len) free(namebuf); namebuf_len = list_len + 1024; namebuf = new_array(char, namebuf_len); if (!namebuf) out_of_memory("get_xattr_names"); } return list_len; }
14,243
94,355
0
static int __blk_send_generic(struct request_queue *q, struct gendisk *bd_disk, int cmd, int data) { struct request *rq; int err; rq = blk_get_request(q, WRITE, __GFP_WAIT); rq->cmd_type = REQ_TYPE_BLOCK_PC; rq->timeout = BLK_DEFAULT_SG_TIMEOUT; rq->cmd[0] = cmd; rq->cmd[4] = data; rq->cmd_len = 6; err = blk_execute_rq(q, bd_disk, rq, 0); blk_put_request(rq); return err; }
14,244
10,081
0
GetShortIns( EXEC_OP ) { /* Reading a byte stream so there is no endianess (DaveP) */ CUR.IP += 2; return (FT_Short)( ( CUR.code[CUR.IP - 2] << 8 ) + CUR.code[CUR.IP - 1] ); }
14,245
69,463
0
static int nfs_idmap_pipe_create(struct dentry *dir, struct rpc_pipe_dir_object *pdo) { struct idmap *idmap = pdo->pdo_data; struct rpc_pipe *pipe = idmap->idmap_pipe; struct dentry *dentry; dentry = rpc_mkpipe_dentry(dir, "idmap", idmap, pipe); if (IS_ERR(dentry)) return PTR_ERR(dentry); pipe->dentry = dentry; return 0; }
14,246
96,013
0
qboolean FS_CreatePath (char *OSPath) { char *ofs; char path[MAX_OSPATH]; if ( strstr( OSPath, ".." ) || strstr( OSPath, "::" ) ) { Com_Printf( "WARNING: refusing to create relative path \"%s\"\n", OSPath ); return qtrue; } Q_strncpyz( path, OSPath, sizeof( path ) ); FS_ReplaceSeparators( path ); ofs = strchr( path, PATH_SEP ); if ( ofs != NULL ) { ofs++; } for (; ofs != NULL && *ofs ; ofs++) { if (*ofs == PATH_SEP) { *ofs = 0; if (!Sys_Mkdir (path)) { Com_Error( ERR_FATAL, "FS_CreatePath: failed to create path \"%s\"", path ); } *ofs = PATH_SEP; } } return qfalse; }
14,247
21,789
0
static int em_sub(struct x86_emulate_ctxt *ctxt) { emulate_2op_SrcV(ctxt, "sub"); return X86EMUL_CONTINUE; }
14,248
90,373
0
megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd) { struct megasas_header *frame_hdr = &cmd->frame->hdr; frame_hdr->cmd_status = MFI_STAT_INVALID_STATUS; frame_hdr->flags |= cpu_to_le16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE); if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) { dev_err(&instance->pdev->dev, "Failed from %s %d\n", __func__, __LINE__); return DCMD_NOT_FIRED; } instance->instancet->issue_dcmd(instance, cmd); return wait_and_poll(instance, cmd, instance->requestorId ? MEGASAS_ROUTINE_WAIT_TIME_VF : MFI_IO_TIMEOUT_SECS); }
14,249
141,283
0
void Document::UpdateSecurityOrigin(scoped_refptr<SecurityOrigin> origin) { SetSecurityOrigin(std::move(origin)); DidUpdateSecurityOrigin(); }
14,250
135,080
0
void AppCacheHost::OnUpdateComplete(AppCacheGroup* group) { DCHECK_EQ(group, group_being_updated_.get()); group->RemoveUpdateObserver(this); SetSwappableCache(group); group_being_updated_ = NULL; newest_cache_of_group_being_updated_ = NULL; if (associated_cache_info_pending_ && associated_cache_.get() && associated_cache_->is_complete()) { AppCacheInfo info; FillCacheInfo( associated_cache_.get(), preferred_manifest_url_, GetStatus(), &info); associated_cache_info_pending_ = false; frontend_->OnCacheSelected(host_id_, info); } }
14,251
99,345
0
void Run() { g_browser_process->clipboard()->WriteObjects(*objects_.get()); }
14,252
115,938
0
Eina_Bool ewk_frame_page_zoom_set(Evas_Object* ewkFrame, float pageZoomFactor) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); smartData->frame->setPageZoomFactor(pageZoomFactor); return true; }
14,253
46,027
0
svcauth_gss_get_principal(SVCAUTH *auth) { struct svc_rpc_gss_data *gd; char *pname; gd = SVCAUTH_PRIVATE(auth); if (gd->cname.length == 0 || gd->cname.length >= SIZE_MAX) return (NULL); if ((pname = malloc(gd->cname.length + 1)) == NULL) return (NULL); memcpy(pname, gd->cname.value, gd->cname.length); pname[gd->cname.length] = '\0'; return (pname); }
14,254
8,967
0
bool net_tx_pkt_send_loopback(struct NetTxPkt *pkt, NetClientState *nc) { bool res; pkt->is_loopback = true; res = net_tx_pkt_send(pkt, nc); pkt->is_loopback = false; return res; }
14,255
144,090
0
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width, double height) { png_debug1(1, "in %s storage function", "sCAL"); if (png_ptr == NULL || info_ptr == NULL) return; info_ptr->scal_unit = (png_byte)unit; info_ptr->scal_pixel_width = width; info_ptr->scal_pixel_height = height; info_ptr->valid |= PNG_INFO_sCAL; }
14,256
151,370
0
String ToHexString(const void* p) { return String::Format("0x%" PRIx64, static_cast<uint64_t>(reinterpret_cast<uintptr_t>(p))); }
14,257
188,151
1
OMXNodeInstance::OMXNodeInstance( OMX *owner, const sp<IOMXObserver> &observer, const char *name) : mOwner(owner), mNodeID(0), mHandle(NULL), mObserver(observer), mDying(false), mBufferIDCount(0) { mName = ADebug::GetDebugName(name); DEBUG = ADebug::GetDebugLevelFromProperty(name, "debug.stagefright.omx-debug"); ALOGV("debug level for %s is %d", name, DEBUG); DEBUG_BUMP = DEBUG; mNumPortBuffers[0] = 0; mNumPortBuffers[1] = 0; mDebugLevelBumpPendingBuffers[0] = 0; mDebugLevelBumpPendingBuffers[1] = 0; mMetadataType[0] = kMetadataBufferTypeInvalid; mMetadataType[1] = kMetadataBufferTypeInvalid; mSecureBufferType[0] = kSecureBufferTypeUnknown; mSecureBufferType[1] = kSecureBufferTypeUnknown; mIsSecure = AString(name).endsWith(".secure"); }
14,258
92,964
0
process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta) { int width, height; if (present & 0x01) in_uint32_le(s, os->offset); if (present & 0x02) rdp_in_coord(s, &os->left, delta); if (present & 0x04) rdp_in_coord(s, &os->top, delta); if (present & 0x08) rdp_in_coord(s, &os->right, delta); if (present & 0x10) rdp_in_coord(s, &os->bottom, delta); if (present & 0x20) in_uint8(s, os->action); logger(Graphics, Debug, "process_desksave(), l=%d, t=%d, r=%d, b=%d, off=%d, op=%d", os->left, os->top, os->right, os->bottom, os->offset, os->action); width = os->right - os->left + 1; height = os->bottom - os->top + 1; if (os->action == 0) ui_desktop_save(os->offset, os->left, os->top, width, height); else ui_desktop_restore(os->offset, os->left, os->top, width, height); }
14,259
78,922
0
CopyInterps(CompatInfo *info, bool needSymbol, enum xkb_match_operation pred, struct collect *collect) { SymInterpInfo *si; darray_foreach(si, info->interps) if (si->interp.match == pred && (si->interp.sym != XKB_KEY_NoSymbol) == needSymbol) darray_append(collect->sym_interprets, si->interp); }
14,260
96,142
0
static int http_close(git_smart_subtransport *subtransport) { http_subtransport *t = (http_subtransport *) subtransport; git_http_auth_context *context; size_t i; clear_parser_state(t); if (t->io) { git_stream_close(t->io); git_stream_free(t->io); t->io = NULL; } if (t->cred) { t->cred->free(t->cred); t->cred = NULL; } if (t->url_cred) { t->url_cred->free(t->url_cred); t->url_cred = NULL; } git_vector_foreach(&t->auth_contexts, i, context) { if (context->free) context->free(context); } git_vector_clear(&t->auth_contexts); gitno_connection_data_free_ptrs(&t->connection_data); memset(&t->connection_data, 0x0, sizeof(gitno_connection_data)); return 0; }
14,261
143,672
0
void RenderWidgetHostImpl::OnSelectionBoundsChanged( const ViewHostMsg_SelectionBounds_Params& params) { if (view_) { view_->SelectionBoundsChanged(params); } }
14,262
3,547
0
gs_heap_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements, client_name_t cname) { gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem; gs_malloc_block_t *ptr = (gs_malloc_block_t *) obj - 1; gs_memory_type_ptr_t pstype = ptr->type; uint old_size = gs_object_size(mem, obj) + sizeof(gs_malloc_block_t); uint new_size = gs_struct_type_size(pstype) * new_num_elements + sizeof(gs_malloc_block_t); gs_malloc_block_t *new_ptr; if (new_size == old_size) return obj; if (mmem->monitor) gx_monitor_enter(mmem->monitor); /* Exclusive access */ new_ptr = (gs_malloc_block_t *) gs_realloc(ptr, old_size, new_size); if (new_ptr == 0) return 0; if (new_ptr->prev) new_ptr->prev->next = new_ptr; else mmem->allocated = new_ptr; if (new_ptr->next) new_ptr->next->prev = new_ptr; new_ptr->size = new_size - sizeof(gs_malloc_block_t); mmem->used -= old_size; mmem->used += new_size; if (mmem->monitor) gx_monitor_leave(mmem->monitor); /* Done with exclusive access */ if (new_size > old_size) gs_alloc_fill((byte *) new_ptr + old_size, gs_alloc_fill_alloc, new_size - old_size); return new_ptr + 1; }
14,263
116,133
0
void ResourceDispatcherHostImpl::DataReceivedACK(int child_id, int request_id) { PendingRequestList::iterator i = pending_requests_.find( GlobalRequestID(child_id, request_id)); if (i == pending_requests_.end()) return; ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(i->second); info->DecrementPendingDataCount(); if (info->pending_data_count() == kMaxPendingDataMessages) { info->DecrementPendingDataCount(); PauseRequest(child_id, request_id, false); } }
14,264
89,870
0
GetTotalBytesSent(struct upnphttp * h, const char * action, const char * ns) { int r; static const char resp[] = "<u:%sResponse " "xmlns:u=\"%s\">" "<NewTotalBytesSent>%lu</NewTotalBytesSent>" "</u:%sResponse>"; char body[512]; int bodylen; struct ifdata data; r = getifstats(ext_if_name, &data); bodylen = snprintf(body, sizeof(body), resp, action, ns, /* was "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" */ #ifdef UPNP_STRICT r<0?0:(data.obytes & UPNP_UI4_MAX), action); #else /* UPNP_STRICT */ r<0?0:data.obytes, action); #endif /* UPNP_STRICT */ BuildSendAndCloseSoapResp(h, body, bodylen); }
14,265
126,153
0
void BrowserLauncherItemController::UpdateItemStatus() { ash::LauncherItemStatus status; if (ash::wm::IsActiveWindow(window_)) { if (window_->GetProperty(aura::client::kDrawAttentionKey)) window_->SetProperty(aura::client::kDrawAttentionKey, false); status = ash::STATUS_ACTIVE; } else if (window_->GetProperty(aura::client::kDrawAttentionKey)) { status = ash::STATUS_ATTENTION; } else { status = ash::STATUS_RUNNING; } launcher_controller()->SetItemStatus(launcher_id(), status); }
14,266
80,806
0
GF_Err nump_dump(GF_Box *a, FILE * trace) { GF_NUMPBox *p; p = (GF_NUMPBox *)a; gf_isom_box_dump_start(a, "LargeTotalPacketBox", trace); fprintf(trace, "PacketsSent=\""LLD"\">\n", LLD_CAST p->nbPackets); gf_isom_box_dump_done("LargeTotalPacketBox", a, trace); return GF_OK; }
14,267
81,879
0
void wc_ecc_fp_free(void) { #ifndef WOLFSSL_SP_MATH #ifndef HAVE_THREAD_LS if (initMutex == 0) { wc_InitMutex(&ecc_fp_lock); initMutex = 1; } if (wc_LockMutex(&ecc_fp_lock) == 0) { #endif /* HAVE_THREAD_LS */ wc_ecc_fp_free_cache(); #ifndef HAVE_THREAD_LS wc_UnLockMutex(&ecc_fp_lock); wc_FreeMutex(&ecc_fp_lock); initMutex = 0; } #endif /* HAVE_THREAD_LS */ #endif }
14,268
126,964
0
void AudioInputRendererHost::OnRecording( media::AudioInputController* controller) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( &AudioInputRendererHost::DoSendRecordingMessage, this, make_scoped_refptr(controller))); }
14,269
163,099
0
std::unique_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( const GURL& url) { std::string uuid; BlobEntry* entry = registry_.GetEntryFromURL(url, &uuid); if (!entry) return nullptr; return CreateHandle(uuid, entry); }
14,270
79,258
0
static int StreamTcpTest37(void) { Packet *p = SCMalloc(SIZE_OF_PACKET); if (unlikely(p == NULL)) return 0; Flow f; ThreadVars tv; StreamTcpThread stt; uint8_t payload[4]; TCPHdr tcph; int ret = 0; PacketQueue pq; memset(&pq,0,sizeof(PacketQueue)); memset(p, 0, SIZE_OF_PACKET); memset (&f, 0, sizeof(Flow)); memset(&tv, 0, sizeof (ThreadVars)); memset(&stt, 0, sizeof (StreamTcpThread)); memset(&tcph, 0, sizeof (TCPHdr)); FLOW_INITIALIZE(&f); p->flow = &f; tcph.th_win = htons(5480); tcph.th_flags = TH_SYN; p->tcph = &tcph; p->flowflags = FLOW_PKT_TOSERVER; StreamTcpUTInit(&stt.ra_ctx); if (StreamTcpPacket(&tv, p, &stt, &pq) == -1) { printf("failed in processing packet\n"); goto end; } p->tcph->th_ack = htonl(1); p->tcph->th_flags = TH_SYN | TH_ACK; p->flowflags = FLOW_PKT_TOCLIENT; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1 || (TcpSession *)p->flow->protoctx == NULL) { printf("failed in processing packet\n"); goto end; } p->tcph->th_ack = htonl(1); p->tcph->th_seq = htonl(1); p->tcph->th_flags = TH_ACK; p->flowflags = FLOW_PKT_TOSERVER; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1 || (TcpSession *)p->flow->protoctx == NULL) { printf("failed in processing packet\n"); goto end; } if (((TcpSession *)p->flow->protoctx)->state != TCP_ESTABLISHED) { printf("the TCP state should be TCP_ESTABLISEHD\n"); goto end; } p->tcph->th_ack = htonl(2); p->tcph->th_seq = htonl(4); p->tcph->th_flags = TH_ACK|TH_FIN; p->flowflags = FLOW_PKT_TOSERVER; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1 || (TcpSession *)p->flow->protoctx == NULL) { printf("failed in processing packet\n"); goto end; } if (((TcpSession *)p->flow->protoctx)->state != TCP_CLOSE_WAIT) { printf("the TCP state should be TCP_CLOSE_WAIT\n"); goto end; } p->tcph->th_ack = htonl(1); p->tcph->th_seq = htonl(1); p->tcph->th_flags = TH_PUSH | TH_ACK; p->flowflags = FLOW_PKT_TOSERVER; StreamTcpCreateTestPacket(payload, 0x41, 3, 4); /*AAA*/ p->payload = payload; p->payload_len = 3; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1 || (TcpSession *)p->flow->protoctx == NULL) { printf("failed in processing packet\n"); goto end; } p->tcph->th_ack = htonl(4); p->tcph->th_seq = htonl(2); p->tcph->th_flags = TH_ACK; p->payload_len = 0; p->flowflags = FLOW_PKT_TOCLIENT; if (StreamTcpPacket(&tv, p, &stt, &pq) == -1 || (TcpSession *)p->flow->protoctx == NULL) { printf("failed in processing packet\n"); goto end; } TcpStream *stream = &(((TcpSession *)p->flow->protoctx)->client); FAIL_IF(STREAM_RAW_PROGRESS(stream) != 0); // no detect no progress update StreamTcpSessionClear(p->flow->protoctx); ret = 1; end: SCFree(p); FLOW_DESTROY(&f); StreamTcpUTDeinit(stt.ra_ctx); return ret; }
14,271
168,245
0
void BrowserView::EnterFullscreen(const GURL& url, ExclusiveAccessBubbleType bubble_type) { if (IsFullscreen()) return; // Nothing to do. ProcessFullscreen(true, url, bubble_type); }
14,272
82,741
0
INST_HANDLER (mulsu) { // MULSU Rd, Rr int d = (buf[0] >> 4 & 0x07) + 16; int r = (buf[0] & 0x07) + 16; ESIL_A ("r%d,", r); // unsigned Rr ESIL_A ("r%d,DUP,0x80,&,?{,0xffff00,|,},", d); // sign extension Rd ESIL_A ("*,"); // 0: (Rd*Rr) ESIL_A ("DUP,0xff,&,r0,=,"); // r0 = LO(0) ESIL_A ("8,0,RPICK,>>,0xff,&,r1,=,"); // r1 = HI(0) ESIL_A ("DUP,0x8000,&,!,!,cf,=,"); // C = R/15 ESIL_A ("DUP,!,zf,=,"); // Z = !R }
14,273
97,974
0
void RenderView::OnPrintingDone(int document_cookie, bool success) { DCHECK(print_helper_.get()); if (print_helper_.get() != NULL) { print_helper_->DidFinishPrinting(success); } }
14,274
42,023
0
void __init shm_init(void) { ipc_init_proc_interface("sysvipc/shm", #if BITS_PER_LONG <= 32 " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", #else " key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap\n", #endif IPC_SHM_IDS, sysvipc_shm_proc_show); }
14,275
28,697
0
static ssize_t lbs_rdrf_write(struct file *file, const char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; ssize_t res, buf_size; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; if (!buf) return -ENOMEM; buf_size = min(count, len - 1); if (copy_from_user(buf, userbuf, buf_size)) { res = -EFAULT; goto out_unlock; } priv->rf_offset = simple_strtoul(buf, NULL, 16); res = count; out_unlock: free_page(addr); return res; }
14,276
125,828
0
void ParamTraits<DictionaryValue>::Write(Message* m, const param_type& p) { WriteValue(m, &p, 0); }
14,277
69,460
0
static int nfs_idmap_lookup_id(const char *name, size_t namelen, const char *type, __u32 *id, struct idmap *idmap) { char id_str[NFS_UINT_MAXLEN]; long id_long; ssize_t data_size; int ret = 0; data_size = nfs_idmap_get_key(name, namelen, type, id_str, NFS_UINT_MAXLEN, idmap); if (data_size <= 0) { ret = -EINVAL; } else { ret = kstrtol(id_str, 10, &id_long); *id = (__u32)id_long; } return ret; }
14,278
7,094
0
tt_cmap13_init( TT_CMap13 cmap, FT_Byte* table ) { cmap->cmap.data = table; table += 12; cmap->num_groups = FT_PEEK_ULONG( table ); cmap->valid = 0; return FT_Err_Ok; }
14,279
131,687
0
static void replaceableReadonlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueInt(info, imp->replaceableReadonlyLongAttribute()); }
14,280
19,285
0
static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk = sock->sk; struct net *net = sock_net(sk); struct unix_sock *u = unix_sk(sk); struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; char *sun_path = sunaddr->sun_path; int err; unsigned int hash; struct unix_address *addr; struct hlist_head *list; err = -EINVAL; if (sunaddr->sun_family != AF_UNIX) goto out; if (addr_len == sizeof(short)) { err = unix_autobind(sock); goto out; } err = unix_mkname(sunaddr, addr_len, &hash); if (err < 0) goto out; addr_len = err; mutex_lock(&u->readlock); err = -EINVAL; if (u->addr) goto out_up; err = -ENOMEM; addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); if (!addr) goto out_up; memcpy(addr->name, sunaddr, addr_len); addr->len = addr_len; addr->hash = hash ^ sk->sk_type; atomic_set(&addr->refcnt, 1); if (sun_path[0]) { struct path path; umode_t mode = S_IFSOCK | (SOCK_INODE(sock)->i_mode & ~current_umask()); err = unix_mknod(sun_path, mode, &path); if (err) { if (err == -EEXIST) err = -EADDRINUSE; unix_release_addr(addr); goto out_up; } addr->hash = UNIX_HASH_SIZE; hash = path.dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1); spin_lock(&unix_table_lock); u->path = path; list = &unix_socket_table[hash]; } else { spin_lock(&unix_table_lock); err = -EADDRINUSE; if (__unix_find_socket_byname(net, sunaddr, addr_len, sk->sk_type, hash)) { unix_release_addr(addr); goto out_unlock; } list = &unix_socket_table[addr->hash]; } err = 0; __unix_remove_socket(sk); u->addr = addr; __unix_insert_socket(list, sk); out_unlock: spin_unlock(&unix_table_lock); out_up: mutex_unlock(&u->readlock); out: return err; }
14,281
159,046
0
void ChromeDownloadManagerDelegate::CheckDownloadUrl( DownloadItem* download, const base::FilePath& suggested_path, const CheckDownloadUrlCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); #if defined(FULL_SAFE_BROWSING) safe_browsing::DownloadProtectionService* service = GetDownloadProtectionService(); if (service) { bool is_content_check_supported = service->IsSupportedDownload(*download, suggested_path); DVLOG(2) << __func__ << "() Start SB URL check for download = " << download->DebugString(false); service->CheckDownloadUrl(download, base::Bind(&CheckDownloadUrlDone, callback, is_content_check_supported)); return; } #endif callback.Run(content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); }
14,282
64,078
0
static void clean_index(AVFormatContext *s) { int i; int64_t j; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; int n = st->nb_index_entries; int max = ast->sample_size; int64_t pos, size, ts; if (n != 1 || ast->sample_size == 0) continue; while (max < 1024) max += max; pos = st->index_entries[0].pos; size = st->index_entries[0].size; ts = st->index_entries[0].timestamp; for (j = 0; j < size; j += max) av_add_index_entry(st, pos + j, ts + j, FFMIN(max, size - j), 0, AVINDEX_KEYFRAME); } }
14,283
111,905
0
void ProfileSyncService::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_SYNC_CONFIGURE_START: case chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED: NotifyObservers(); break; case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: { DCHECK(cached_passphrase_.empty()); DataTypeManager::ConfigureResult* result = content::Details<DataTypeManager::ConfigureResult>(details).ptr(); configure_status_ = result->status; DVLOG(1) << "PSS SYNC_CONFIGURE_DONE called with status: " << configure_status_; if (configure_status_ == DataTypeManager::ABORTED && expect_sync_configuration_aborted_) { DVLOG(0) << "ProfileSyncService::Observe Sync Configure aborted"; expect_sync_configuration_aborted_ = false; return; } if (configure_status_ == DataTypeManager::RETRY) { OnSyncConfigureRetry(); return; } if (configure_status_ != DataTypeManager::OK && configure_status_ != DataTypeManager::PARTIAL_SUCCESS) { DCHECK_EQ(result->failed_data_types.size(), static_cast<unsigned int>(1)); SyncError error = result->failed_data_types.front(); DCHECK(error.IsSet()); std::string message = "Sync configuration failed with status " + DataTypeManager::ConfigureStatusToString(configure_status_) + " during " + syncable::ModelTypeToString(error.type()) + ": " + error.message(); LOG(ERROR) << "ProfileSyncService error: " << message; OnUnrecoverableError(error.location(), message); return; } MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&ProfileSyncService::OnSyncConfigureDone, weak_factory_.GetWeakPtr(), *result)); DCHECK(!(IsPassphraseRequiredForDecryption() && !IsEncryptedDatatypeEnabled())); if (encryption_pending_) backend_->EnableEncryptEverything(); NotifyObservers(); if (migrator_.get() && migrator_->state() != browser_sync::BackendMigrator::IDLE) { migrator_->OnConfigureDone(*result); } else { StartSyncingWithServer(); } break; } case chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL: { const GoogleServiceSigninSuccessDetails* successful = content::Details<const GoogleServiceSigninSuccessDetails>( details).ptr(); DCHECK(!successful->password.empty()); if (!sync_prefs_.IsStartSuppressed()) { cached_passphrase_ = successful->password; ConsumeCachedPassphraseIfPossible(); } #if defined(OS_CHROMEOS) RefreshSpareBootstrapToken(successful->password); #endif if (!sync_initialized() || GetAuthError().state() != GoogleServiceAuthError::NONE) { is_auth_in_progress_ = true; } break; } case chrome::NOTIFICATION_TOKEN_REQUEST_FAILED: { const TokenService::TokenRequestFailedDetails& token_details = *(content::Details<const TokenService::TokenRequestFailedDetails>( details).ptr()); if (IsTokenServiceRelevant(token_details.service()) && !IsSyncTokenAvailable()) { GoogleServiceAuthError error( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); UpdateAuthErrorState(error); } break; } case chrome::NOTIFICATION_TOKEN_AVAILABLE: { const TokenService::TokenAvailableDetails& token_details = *(content::Details<const TokenService::TokenAvailableDetails>( details).ptr()); if (IsTokenServiceRelevant(token_details.service()) && IsSyncEnabledAndLoggedIn() && IsSyncTokenAvailable()) { if (backend_initialized_) backend_->UpdateCredentials(GetCredentials()); else StartUp(); } break; } case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: { if (IsSyncEnabledAndLoggedIn()) { if (auto_start_enabled_ && !IsSyncTokenAvailable()) break; if (backend_initialized_) backend_->UpdateCredentials(GetCredentials()); else StartUp(); } break; } default: { NOTREACHED(); } } }
14,284
859
0
void ArthurOutputDev::startDoc(XRef *xrefA) { xref = xrefA; delete m_fontEngine; m_fontEngine = new SplashFontEngine( #if HAVE_T1LIB_H globalParams->getEnableT1lib(), #endif #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H globalParams->getEnableFreeType(), #endif m_painter->testRenderHint(QPainter::TextAntialiasing)); }
14,285
27,198
0
void id_link(int id, void *ptr) { g_hash_table_insert(g_ids, id_key(id), ptr); }
14,286
123,833
0
bool WaitForExtensionViewsToLoad() { content::NotificationRegistrar registrar; registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, content::NotificationService::AllSources()); base::CancelableClosure timeout( base::Bind(&TimeoutCallback, "Extension host load timed out.")); MessageLoop::current()->PostDelayedTask( FROM_HERE, timeout.callback(), base::TimeDelta::FromSeconds(4)); ExtensionProcessManager* manager = extensions::ExtensionSystem::Get(browser()->profile())-> process_manager(); ExtensionProcessManager::ViewSet all_views = manager->GetAllViews(); for (ExtensionProcessManager::ViewSet::const_iterator iter = all_views.begin(); iter != all_views.end();) { if (!(*iter)->IsLoading()) ++iter; else content::RunMessageLoop(); } timeout.Cancel(); return true; }
14,287
115,815
0
virtual ~FakeMalwareDetails() {}
14,288
12,615
0
static void usb_net_reset_in_buf(USBNetState *s) { s->in_ptr = s->in_len = 0; qemu_flush_queued_packets(qemu_get_queue(s->nic)); }
14,289
155,947
0
void PeopleHandler::OnJavascriptDisallowed() { profile_pref_registrar_.RemoveAll(); identity_manager_observer_.RemoveAll(); sync_service_observer_.RemoveAll(); #if BUILDFLAG(ENABLE_DICE_SUPPORT) account_tracker_observer_.RemoveAll(); #endif }
14,290
50,805
0
idr_relaxed_filenames(char *map) { int i; for (i = 0x21; i <= 0x2F; i++) map[i] = 1; for (i = 0x3A; i <= 0x41; i++) map[i] = 1; for (i = 0x5B; i <= 0x5E; i++) map[i] = 1; map[0x60] = 1; for (i = 0x7B; i <= 0x7E; i++) map[i] = 1; }
14,291
173,552
0
static int session_init(struct session_s *session) { size_t i; int status = 0; session->state = SESSION_STATE_INIT; session->id = 0; session->io = 0; session->created_msk = 0; for (i = 0; i < NUM_ID && status == 0; i++) status = effect_init(&session->effects[i], i); return status; }
14,292
111,609
0
void VerifyCacheFileState(base::PlatformFileError error, const std::string& resource_id, const std::string& md5) { ++num_callback_invocations_; EXPECT_EQ(expected_error_, error); GDataRootDirectory::CacheEntry* entry = file_system_->root_->GetCacheEntry(resource_id, md5); if (GDataFile::IsCachePresent(expected_cache_state_) || GDataFile::IsCachePinned(expected_cache_state_)) { ASSERT_TRUE(entry != NULL); EXPECT_EQ(expected_cache_state_, entry->cache_state); EXPECT_EQ(expected_sub_dir_type_, entry->sub_dir_type); } else { EXPECT_TRUE(entry == NULL); } FilePath dest_path = file_system_->GetCacheFilePath( resource_id, md5, GDataFile::IsCachePinned(expected_cache_state_) || GDataFile::IsCacheDirty(expected_cache_state_) ? GDataRootDirectory::CACHE_TYPE_PERSISTENT : GDataRootDirectory::CACHE_TYPE_TMP, GDataFile::IsCacheDirty(expected_cache_state_) ? GDataFileSystem::CACHED_FILE_LOCALLY_MODIFIED : GDataFileSystem::CACHED_FILE_FROM_SERVER); bool exists = file_util::PathExists(dest_path); if (GDataFile::IsCachePresent(expected_cache_state_)) EXPECT_TRUE(exists); else EXPECT_FALSE(exists); FilePath symlink_path = file_system_->GetCacheFilePath( resource_id, std::string(), GDataRootDirectory::CACHE_TYPE_PINNED, GDataFileSystem::CACHED_FILE_FROM_SERVER); exists = file_util::IsLink(symlink_path); if (GDataFile::IsCachePinned(expected_cache_state_)) { EXPECT_TRUE(exists); FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); if (GDataFile::IsCachePresent(expected_cache_state_)) EXPECT_EQ(dest_path, target_path); else EXPECT_EQ(kSymLinkToDevNull, target_path.value()); } else { EXPECT_FALSE(exists); } symlink_path = file_system_->GetCacheFilePath( resource_id, std::string(), GDataRootDirectory::CACHE_TYPE_OUTGOING, GDataFileSystem::CACHED_FILE_FROM_SERVER); exists = file_util::IsLink(symlink_path); if (expect_outgoing_symlink_ && GDataFile::IsCacheDirty(expected_cache_state_)) { EXPECT_TRUE(exists); FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); EXPECT_TRUE(target_path.value() != kSymLinkToDevNull); if (GDataFile::IsCachePresent(expected_cache_state_)) EXPECT_EQ(dest_path, target_path); } else { EXPECT_FALSE(exists); } }
14,293
158,784
0
void NavigateToDataURLAndCheckForTerminationDisabler( Shell* shell, const std::string& html, bool expect_onunload, bool expect_onbeforeunload) { NavigateToURL(shell, GURL("data:text/html," + html)); RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(shell->web_contents()->GetMainFrame()); EXPECT_EQ(expect_onunload, rfh->GetSuddenTerminationDisablerState(blink::kUnloadHandler)); EXPECT_EQ(expect_onbeforeunload, rfh->GetSuddenTerminationDisablerState( blink::kBeforeUnloadHandler)); }
14,294
54,540
0
static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_rb32(pb); // version + flags entries = avio_rb32(pb); if (entries >= UINT_MAX / sizeof(*sc->stps_data)) return AVERROR_INVALIDDATA; sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data)); if (!sc->stps_data) return AVERROR(ENOMEM); sc->stps_count = entries; for (i = 0; i < entries; i++) { sc->stps_data[i] = avio_rb32(pb); } return 0; }
14,295
173,483
0
OMX_ERRORTYPE omx_vdec::push_input_h264 (OMX_HANDLETYPE hComp) { OMX_U32 partial_frame = 1; unsigned long address = 0, p2 = 0, id = 0; OMX_BOOL isNewFrame = OMX_FALSE; OMX_BOOL generate_ebd = OMX_TRUE; if (h264_scratch.pBuffer == NULL) { DEBUG_PRINT_ERROR("ERROR:H.264 Scratch Buffer not allocated"); return OMX_ErrorBadParameter; } DEBUG_PRINT_LOW("Pending h264_scratch.nFilledLen %u " "look_ahead_nal %d", (unsigned int)h264_scratch.nFilledLen, look_ahead_nal); DEBUG_PRINT_LOW("Pending pdest_frame->nFilledLen %u",(unsigned int)pdest_frame->nFilledLen); if (h264_scratch.nFilledLen && look_ahead_nal) { look_ahead_nal = false; if ((pdest_frame->nAllocLen - pdest_frame->nFilledLen) >= h264_scratch.nFilledLen) { memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen), h264_scratch.pBuffer,h264_scratch.nFilledLen); pdest_frame->nFilledLen += h264_scratch.nFilledLen; DEBUG_PRINT_LOW("Copy the previous NAL (h264 scratch) into Dest frame"); h264_scratch.nFilledLen = 0; } else { DEBUG_PRINT_ERROR("Error:1: Destination buffer overflow for H264"); return OMX_ErrorBadParameter; } } /* If an empty input is queued with EOS, do not coalesce with the destination-frame yet, as this may result in EOS flag getting associated with the destination */ if (!psource_frame->nFilledLen && (psource_frame->nFlags & OMX_BUFFERFLAG_EOS) && pdest_frame->nFilledLen) { DEBUG_PRINT_HIGH("delay ETB for 'empty buffer with EOS'"); generate_ebd = OMX_FALSE; } if (nal_length == 0) { DEBUG_PRINT_LOW("Zero NAL, hence parse using start code"); if (m_frame_parser.parse_sc_frame(psource_frame, &h264_scratch,&partial_frame) == -1) { DEBUG_PRINT_ERROR("Error In Parsing Return Error"); return OMX_ErrorBadParameter; } } else { DEBUG_PRINT_LOW("Non-zero NAL length clip, hence parse with NAL size %d ",nal_length); if (m_frame_parser.parse_h264_nallength(psource_frame, &h264_scratch,&partial_frame) == -1) { DEBUG_PRINT_ERROR("Error In Parsing NAL size, Return Error"); return OMX_ErrorBadParameter; } } if (partial_frame == 0) { if (nal_count == 0 && h264_scratch.nFilledLen == 0) { DEBUG_PRINT_LOW("First NAL with Zero Length, hence Skip"); nal_count++; h264_scratch.nTimeStamp = psource_frame->nTimeStamp; h264_scratch.nFlags = psource_frame->nFlags; } else { DEBUG_PRINT_LOW("Parsed New NAL Length = %u",(unsigned int)h264_scratch.nFilledLen); if (h264_scratch.nFilledLen) { h264_parser->parse_nal((OMX_U8*)h264_scratch.pBuffer, h264_scratch.nFilledLen, NALU_TYPE_SPS); #ifndef PROCESS_EXTRADATA_IN_OUTPUT_PORT if (client_extradata & OMX_TIMEINFO_EXTRADATA) h264_parser->parse_nal((OMX_U8*)h264_scratch.pBuffer, h264_scratch.nFilledLen, NALU_TYPE_SEI); else if (client_extradata & OMX_FRAMEINFO_EXTRADATA) h264_parser->parse_nal((OMX_U8*)h264_scratch.pBuffer, h264_scratch.nFilledLen, NALU_TYPE_SEI); #endif m_frame_parser.mutils->isNewFrame(&h264_scratch, 0, isNewFrame); nal_count++; if (VALID_TS(h264_last_au_ts) && !VALID_TS(pdest_frame->nTimeStamp)) { pdest_frame->nTimeStamp = h264_last_au_ts; pdest_frame->nFlags = h264_last_au_flags; #ifdef PANSCAN_HDLR if (client_extradata & OMX_FRAMEINFO_EXTRADATA) h264_parser->update_panscan_data(h264_last_au_ts); #endif } if (m_frame_parser.mutils->nalu_type == NALU_TYPE_NON_IDR || m_frame_parser.mutils->nalu_type == NALU_TYPE_IDR) { h264_last_au_ts = h264_scratch.nTimeStamp; h264_last_au_flags = h264_scratch.nFlags; #ifndef PROCESS_EXTRADATA_IN_OUTPUT_PORT if (client_extradata & OMX_TIMEINFO_EXTRADATA) { OMX_S64 ts_in_sei = h264_parser->process_ts_with_sei_vui(h264_last_au_ts); if (!VALID_TS(h264_last_au_ts)) h264_last_au_ts = ts_in_sei; } #endif } else h264_last_au_ts = LLONG_MAX; } if (!isNewFrame) { if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >= h264_scratch.nFilledLen) { DEBUG_PRINT_LOW("Not a NewFrame Copy into Dest len %u", (unsigned int)h264_scratch.nFilledLen); memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen), h264_scratch.pBuffer,h264_scratch.nFilledLen); pdest_frame->nFilledLen += h264_scratch.nFilledLen; if (m_frame_parser.mutils->nalu_type == NALU_TYPE_EOSEQ) pdest_frame->nFlags |= QOMX_VIDEO_BUFFERFLAG_EOSEQ; h264_scratch.nFilledLen = 0; } else { DEBUG_PRINT_LOW("Error:2: Destination buffer overflow for H264"); return OMX_ErrorBadParameter; } } else if(h264_scratch.nFilledLen) { look_ahead_nal = true; DEBUG_PRINT_LOW("Frame Found start Decoding Size =%u TimeStamp = %llu", (unsigned int)pdest_frame->nFilledLen,pdest_frame->nTimeStamp); DEBUG_PRINT_LOW("Found a frame size = %u number = %d", (unsigned int)pdest_frame->nFilledLen,frame_count++); if (pdest_frame->nFilledLen == 0) { DEBUG_PRINT_LOW("Copy the Current Frame since and push it"); look_ahead_nal = false; if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >= h264_scratch.nFilledLen) { memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen), h264_scratch.pBuffer,h264_scratch.nFilledLen); pdest_frame->nFilledLen += h264_scratch.nFilledLen; h264_scratch.nFilledLen = 0; } else { DEBUG_PRINT_ERROR("Error:3: Destination buffer overflow for H264"); return OMX_ErrorBadParameter; } } else { if (psource_frame->nFilledLen || h264_scratch.nFilledLen) { DEBUG_PRINT_LOW("Reset the EOS Flag"); pdest_frame->nFlags &= ~OMX_BUFFERFLAG_EOS; } /*Push the frame to the Decoder*/ if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone) { return OMX_ErrorBadParameter; } pdest_frame = NULL; if (m_input_free_q.m_size) { m_input_free_q.pop_entry(&address,&p2,&id); pdest_frame = (OMX_BUFFERHEADERTYPE *) address; DEBUG_PRINT_LOW("Pop the next pdest_buffer %p",pdest_frame); pdest_frame->nFilledLen = 0; pdest_frame->nFlags = 0; pdest_frame->nTimeStamp = LLONG_MAX; } } } } } else { DEBUG_PRINT_LOW("Not a Complete Frame, pdest_frame->nFilledLen %u", (unsigned int)pdest_frame->nFilledLen); /*Check if Destination Buffer is full*/ if (h264_scratch.nAllocLen == h264_scratch.nFilledLen + h264_scratch.nOffset) { DEBUG_PRINT_ERROR("ERROR: Frame Not found though Destination Filled"); return OMX_ErrorStreamCorrupt; } } if (!psource_frame->nFilledLen) { DEBUG_PRINT_LOW("Buffer Consumed return source %p back to client",psource_frame); if (psource_frame->nFlags & OMX_BUFFERFLAG_EOS) { if (pdest_frame) { DEBUG_PRINT_LOW("EOS Reached Pass Last Buffer"); if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >= h264_scratch.nFilledLen) { if(pdest_frame->nFilledLen == 0) { /* No residual frame from before, send whatever * we have left */ memcpy((pdest_frame->pBuffer + pdest_frame->nFilledLen), h264_scratch.pBuffer, h264_scratch.nFilledLen); pdest_frame->nFilledLen += h264_scratch.nFilledLen; h264_scratch.nFilledLen = 0; pdest_frame->nTimeStamp = h264_scratch.nTimeStamp; } else { m_frame_parser.mutils->isNewFrame(&h264_scratch, 0, isNewFrame); if(!isNewFrame) { /* Have a residual frame, but we know that the * AU in this frame is belonging to whatever * frame we had left over. So append it */ memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen), h264_scratch.pBuffer,h264_scratch.nFilledLen); pdest_frame->nFilledLen += h264_scratch.nFilledLen; h264_scratch.nFilledLen = 0; if (h264_last_au_ts != LLONG_MAX) pdest_frame->nTimeStamp = h264_last_au_ts; } else { /* Completely new frame, let's just push what * we have now. The resulting EBD would trigger * another push */ generate_ebd = OMX_FALSE; pdest_frame->nTimeStamp = h264_last_au_ts; h264_last_au_ts = h264_scratch.nTimeStamp; } } } else { DEBUG_PRINT_ERROR("ERROR:4: Destination buffer overflow for H264"); return OMX_ErrorBadParameter; } /* Iff we coalesced two buffers, inherit the flags of both bufs */ if(generate_ebd == OMX_TRUE) { pdest_frame->nFlags = h264_scratch.nFlags | psource_frame->nFlags; } DEBUG_PRINT_LOW("pdest_frame->nFilledLen =%u TimeStamp = %llu", (unsigned int)pdest_frame->nFilledLen,pdest_frame->nTimeStamp); DEBUG_PRINT_LOW("Push AU frame number %d to driver", frame_count++); #ifndef PROCESS_EXTRADATA_IN_OUTPUT_PORT if (client_extradata & OMX_TIMEINFO_EXTRADATA) { OMX_S64 ts_in_sei = h264_parser->process_ts_with_sei_vui(pdest_frame->nTimeStamp); if (!VALID_TS(pdest_frame->nTimeStamp)) pdest_frame->nTimeStamp = ts_in_sei; } #endif /*Push the frame to the Decoder*/ if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone) { return OMX_ErrorBadParameter; } frame_count++; pdest_frame = NULL; } else { DEBUG_PRINT_LOW("Last frame in else dest addr %p size %u", pdest_frame, (unsigned int)h264_scratch.nFilledLen); generate_ebd = OMX_FALSE; } } } if (generate_ebd && !psource_frame->nFilledLen) { m_cb.EmptyBufferDone (hComp,m_app_data,psource_frame); psource_frame = NULL; if (m_input_pending_q.m_size) { DEBUG_PRINT_LOW("Pull Next source Buffer %p",psource_frame); m_input_pending_q.pop_entry(&address,&p2,&id); psource_frame = (OMX_BUFFERHEADERTYPE *) address; DEBUG_PRINT_LOW("Next source Buffer flag %u src length %u", (unsigned int)psource_frame->nFlags, (unsigned int)psource_frame->nFilledLen); } } return OMX_ErrorNone; }
14,296
39,121
0
dccp_timeout_obj_to_nlattr(struct sk_buff *skb, const void *data) { const unsigned int *timeouts = data; int i; for (i=CTA_TIMEOUT_DCCP_UNSPEC+1; i<CTA_TIMEOUT_DCCP_MAX+1; i++) { if (nla_put_be32(skb, i, htonl(timeouts[i] / HZ))) goto nla_put_failure; } return 0; nla_put_failure: return -ENOSPC; }
14,297
75,875
0
vrrp_mcast_group6_handler(vector_t *strvec) { struct sockaddr_in6 *mcast = &global_data->vrrp_mcast_group6; int ret; ret = inet_stosockaddr(strvec_slot(strvec, 1), 0, (struct sockaddr_storage *)mcast); if (ret < 0) { report_config_error(CONFIG_GENERAL_ERROR, "Configuration error: Cant parse vrrp_mcast_group6 [%s]. Skipping" , FMT_STR_VSLOT(strvec, 1)); } }
14,298
153,668
0
bool GLES2Implementation::GetActiveUniformsivHelper(GLuint program, GLsizei count, const GLuint* indices, GLenum pname, GLint* params) { base::CheckedNumeric<uint32_t> bytes = count; bytes *= sizeof(GLuint); if (!bytes.IsValid()) { SetGLError(GL_INVALID_VALUE, "glGetActiveUniformsiv", "count overflow"); return false; } SetBucketContents(kResultBucketId, indices, bytes.ValueOrDefault(0)); typedef cmds::GetActiveUniformsiv::Result Result; auto result = GetResultAs<Result>(); if (!result) { return false; } result->SetNumResults(0); helper_->GetActiveUniformsiv(program, kResultBucketId, pname, GetResultShmId(), result.offset()); WaitForCmd(); bool success = result->GetNumResults() == count; if (success) { if (params) { result->CopyResult(params); } GPU_CLIENT_LOG_CODE_BLOCK({ for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); } helper_->SetBucketSize(kResultBucketId, 0); return success; }
14,299